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.
Related
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.
In my app, I use the CallKit to identify any call from my app user. And there is a logic pop up an alert window that checks whether the user has turned on the Identify and Blocking in app settings. (which you see in my screen shot). And this is the reason I got my app rejected by apple. They told me to add some privacy key in info.plist. But there is no any private key related to Callkit calling identify.
So, I do not know how to deal with this, is there any one have same experience
?Please show me what you do to this problem, thx a lot.
There's conflicting information about this. One (accepted) answer here says it's not needed, but the comments in this blog post and this StackOverflow answer says the key you are looking to add is NSVoIPUsageDescription (for CallKit and VoIP).
So that's the key I would add into my Info.plist file, along with a description string in the value section.
This Apple forum thread has a different possible key that you could try, too.
I've assumed that putting NSBluetoothPeripheralUsageDescription into info.plist will automatically trigger the alert view (at appropriate time) which will among the other things, show the (localized) error defined in InfoPlist.strings(current language). I assumed something like that, because of this statement from the docs:
NSBluetoothPeripheralUsageDescription (String - iOS) This key lets
you describe the reason your app uses Bluetooth. When the system
prompts the user to allow usage, the value that you provide for this
key is displayed as part of the alert.
Take a look at into this part:
When the system prompts the user to allow usage ...
IMO, this means that alert will be popped out automatically, rather than manually in the code by me.
I am using :
CoreBluetooth framework and many of its classes like:
CBPeripheral, CBCharacteristic, CBCentralManager etc. so I guess this alert should pop out. Of course, I can pop out the alert view by myself on the first use of Bluetooth, but I thought that point of these info.plist keys is, actually to warn the user automatically...
Not quite...
I would hate to have iOS automatically pop up every permission request dialog when the app first runs. Much better to allow me to show "Can I use the camera?" the first time the user gets to the section of my app where the camera is used, and "Can I use Bluetooth" when that section is used.
So, the strings are required so the users are not presented with generic "App wants to use Bluetooth" requests. Instead, you have to provide a suitably informative string (subject to the reviewer's opinion, of course).
But it won't be presented to the user until you want it to be shown.
Maybe you already answered the system popup and have an entry in the iOS settings? In this case iOS will not ask anymore.
I am new to iOS. Is it possible to show a custom view or dialog in place of the default iOS location permission dialog?
No, this dialog is presented by the operating system and you cannot modify it. It is an important part of privacy management that the dialog is presented in a consistent way for all apps and that apps cannot modify the permission process.
You can display a custom view or alert prior to requesting permissions that explains what is happening and the need to click "allow" on the alert that is about to be presented
Direct Answer is it's not possible
explanation :
Only option is set description string by using Cocoa Keys(The keys associated with the Cocoa touch environments)
Add one of these key to
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
Info.plist and set it's value to whatever which describe the purpose of getting location
ex:
MyApp picks you up from where you are. To book airport rides, choose “Allow” so the app can find your location.
Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses the user’s location information, must statically declare the intent to do so. Include the NSLocationAlwaysUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access the user’s location information without a corresponding purpose string, your app exits.
If you looking for localization for that message
Link
The iOS Human Interface Guidelines state:
You can provide text that appears in the alert, below a
system-provided title such as ““App Name” Would Like to Access Your
Contacts”
Where? There's no option for me to add my own message in EKEventStore's requestAccessToEntityType:completion: method. I want to add a completely new calendar to the user's calendar store, not modify an existing one, if that matters.
Am I looking in the right place?
You can add NSCalendarsUsageDescription key to your info.Plist and that should be enough
Source : Information Property List Key Reference
NSCalendarsUsageDescription (String - iOS) describes the reason that
the app accesses the user’s calendars. 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.