Objective-C : Dynamic message in info.plist - ios

Can I change the camera access permission info.plist message dynamically in Objective-C, because I need to show some dynamic values in message from API response.

Short answer: You can't.
But I met with custom info popups before system popups.
Other solution would be to have Info.plist localized in multiple languages and then before showing system popup just force localisation based on which text you want to display.(I didn't test this)
BTW why would you wanna do that?

Related

Setting title when requesting permissions?

I am requesting permissions for the Music Library but this question is equally appropriate for any permissions that can be requested.
I have set the key and value in the project plist:
Privacy - Media Library Usage Description: Access to Media Library may be required to integrate music. This can be configured in Settings.
I have then added the code to display the native alert:
MPMediaLibrary.requestAuthorization { status in
}
This is all working as expected.
The issue is that I want to set the title of the permissions alert to a custom title.
I would like a custom title instead of:
AppName would like to access Apple Music, your music and video activity, and your media library
I can see many reasons why this wouldn't be configurable, Apple not wanting people lying, or being able to lie, about the permissions being requested being the main one.
It would be great to know whether this is possible and then any indication of how to do it if so. Otherwise the knowledge that it isn't possible is equally as valuable.
You can't change the fixed title of the message. Your own message is shown below the bold title.
Your specific privacy message should explain to the user why your app needs access. That's the best you can do.

Setting NSCameraUsageDescription programmatically?

I have a requirement to display a different camera permissions message, one for when the user starts the QR scanner, and one for taking a photo.
The user can start with either one, and product don't want to use a generic message for both.
Is there a way to set NSCameraUsageDescription programmatically, or can this only be done within Info.plist?
Thanks
You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.
You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.
As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.
Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.
Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.

Siri Shortcuts: How do I create a UI for the intent parameters of an iOS shortcut?

I'm trying to create an INIntent to be set up with the new iOS Shortcuts app in iOS 12. I have read the documentation and watched the apple video about it.
I have managed to set everything up and the shortcuts work well, however I can’t seem to figure out how to make customizable options that the user can edit when setting up the shortcut. An example of this would be how the Calendar app’s shortcuts are set up:
Notice the options for Get, Add Filter, Sort by, etc..
I know I can add parameters to the intents in the Intents.intentdefeniton file, but those parameters needs to be set from the app itself before the interaction is donated to the iOS system via SiriKit.
Regardless of what I do the Intent just shows up empty without options.
Any help is appreciated!
I am sorry to bring you bad news, but there is no way to do that. The apps that appear there (like Trello, Overcast, Pocket, etc...) were already supported by Workflow.app before Shortcuts.app was released.
You can try to work around it by calling URL Schemes directly but it might not be the solution you are after.
I think you need to create an Intents UI Extension for this.
https://developer.apple.com/documentation/sirikit/creating_an_intents_ui_extension

How to change the message 'Allow "App" to access your location ' in ios

I know this is default message shown by IOS as a privacy policy to display this message if your app is using the gps location.
My question is I want to change this message with my own message . If anybody knows that please let me know so I may change it.
For better understanding screenshot given below:
Thanks
Surjan!
I believe what you're looking for is in your app's plist. Add in a row for NSLocationUsageDescription (or if you're using the formatted values, its the Privacy Usage - Location). Whatever your description is should appear in the alert view from then on.

HOWTO set the text of the AddressBookAccessRequest alertView?

I know that in iOS 6 we should request the access to contacts first like below :
But now, I wonder how to add detail message in the alert view, just between the alert-title and two buttons. I did see some-app had done that.
I use ABAddressBookCreateWithOptions and ABAddressBookRequestAccessWithCompletion, but the previous one's option is reserved as NULL while the later one only accepts a callback block.
I searched a lot, like another Q, iOS 6 Release Notes and Apple Doc, but failed to make it.
Thanks a lot for any help. :)
You can use NSContactsUsageDescription key for this purpose.
Add this key to your info.plist and add the Message you want to display as the value.
NSContactsUsageDescription
NSContactsUsageDescription (String - iOS) describes the reason that
the app accesses the user’s contacts. When the system prompts the user
to allow access, this string is displayed as part of the dialog box.
This key is supported in iOS 6.0 and later.
Please check InfoPlistKeyReference for more keys.

Resources