Ios: Custom Permission Alert View Text

iOS: Custom permission alert view text

Under iOS 6 and above, these can be setup to show specific messages. Edit your Info.plist by adding a few new entries. The keys all begin with "Privacy - " (the raw keys are NSxxxUsageDescription where xxx is Contacts, Locations, Reminders, PhotoLibrary, or Calendards). The value is the text you wish to display to the user.

Unbolding Notification Permission UI Alert Action Text

You can't alter the text of the presented permission alert as it's get displayed by the system and there is no public api to access/edit it

Custom message when requesting user's permission to Contacts

Go into your Info.plist file, add the following key NSContactsUsageDescription, and add your custom alert message in the value field.

Is it possible to have a custom dialog message when asking for notification permissions?

You are not able to customize this message. Read Here for more information.

The recommended way that most apps handle this is by first presenting their own dialog, then show the Apple system dialog.

So when it comes time to ask the user for notification permissions, first you trigger your own custom alert that says something like "Please allow your-app-name to send you notifications..." and maybe a brief description of why the user should allow this. With this alert, only add one action to the UIAlertController, I usually just have the action title set to "Ok" and use .default as the style. In the completion handler of this "Ok" UIAlertAction that is when you will trigger the Apple system dialogue which presents the generic UIAlertController with the option for the user to either accept or deny permissions for your app to send notifications.

So the flow is something like -> users reaches point in app where they have to decide if they want to accept or deny notifications permissions -> app presents UIAlertController that is essentially just an explanation of why the app wants/needs to send notifications -> once user taps "Ok" then trigger the generic system alert that actually makes the user choose to accept or deny notification permission.

There seems to be some psychological advantage to doing it this way. By sort of forcing the user to tap "ok" to notifications in the first dialogue, it primes them to tap "allow notifications" in the generic Apple dialogue displayed immediately after.

EDIT Dec 2020 -
Alternatively what I see a lot of apps doing now is offering an "Accept" action and a "Maybe later" action in their custom alert. If the user taps accept, then the app displays the Apple system alert which allows the user to actually Accept/Deny notifications. If the user taps "Maybe later" then the app does NOT display Apple's system dialogue. This way the user never taps DENY on the Apple system dialogue and therefore the app is still allowed to show it in the future without having to make the user manually change the app's notification preferences via the iOS settings app.

EDIT Mar 2021 - (see @blackjacx comment) Apple has rejected (at least 1) app(s) for using a "priming" dialogue before showing the system alert. So that approach seems like it is no longer allowed.

iOS Push Notification Custom Alert

When you register for notifications, a popup will appear asking the user for permission (unless he/she already gave permission before):

The first time you call the registerUserNotificationSettings: method, iOS presents a dialog that asks the user for permission to present the types of notifications the app registered.

You cannot use a custom alert, like for instance when you ask for permission to use the user's location, or his/her contacts. This question has a nice link where you can find which permission alerts you can customize.

Display two different text for one permission

The permission text is set in info.plist, so you cannot change it at runtime.

The permission dialog is only shown the first time that you request access to the camera, so it doesn't really make sense to have action specific permission requests; once permission is either granted or denied there are no further prompts shown to the user.

Your permission text should describe why you need access to the camera, perhaps mentioning both uses. Something like

MyGroovyApp needs access to the camera to create awesome selfies and to scan barcodes

Before requesting permission you could display an alert that explains why you are going to request permission. You can use whatever text you like in this alert.

Setting title when requesting permissions?

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.



Related Topics



Leave a reply



Submit