46

When an iOS app attempts to register for push notifications for the first time, the system pops up a permissions dialog asking the user for permission to receive push notifications. Is it possible to customize the text of this dialog, to explain why these permissions are being sought?

Most permission dialog messages can be customized by putting in an NS*UsageDescription Info.plist key. For example the NSCameraUsageDescription key controls what dialog text to display when requesting access to the user's camera. But there does not appear to be such a key for push notifications.

David Foster
  • 6,931
  • 4
  • 41
  • 42
  • I'd like to re-open this question. I remember reading somewhere that in iOS 7 you can customize the permission dialog, I can't remember where I read this now though. Can someone help? – Daniel T. Nov 18 '13 at 21:47
  • 1
    I think the customization for permission dialogs (since iOS 6) only applies to other permission types, but for more details, you can read this question: http://stackoverflow.com/questions/14158871/ios-custom-permission-alert-view-text/14161372#14161372 – Arkaaito May 06 '14 at 23:04
  • 2
    @DanielT. yes we can only for subtitle please see this think https://developer.apple.com/library/IOs/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html – user100 Nov 20 '14 at 12:23
  • This is surprising, it would be relatively easy for Apple to allow the key in `InfoPlist.strings`. Or if there's no customization point for policy reasons, then Apple should localize it themselves like the other automatic dialogs and buttons (like "OK", "done", "cancel", etc). – TruMan1 Jun 26 '17 at 17:20

7 Answers7

54

No, this is a system dialog which cannot be customized.

melsam
  • 4,947
  • 1
  • 22
  • 23
  • 2
    As a workaround, a separate dialog can be displayed prior to taking action that would show the system permissions dialog. – David Foster Jun 12 '12 at 02:47
  • @David Foster is it possible to change the permission dilog box (camera persmission) text to chineese ? how to do it have any idea? – Ramesh.G Aug 10 '17 at 06:10
  • @Ramesh 1. Yes, you can add whatever text you want as permission text in plist file, but for location service you can't, its system dialogue. 2. If app supports internalisation, follow this https://stackoverflow.com/questions/25736700/how-to-localise-a-string-inside-the-ios-info-plist-file – Suresh Durishetti Aug 31 '17 at 06:34
12

One workaround that I have seen involves an app bringing up its own custom dialog explaining why it needs a permission. Then immediately afterwards the app requests the permission, bringing up the system dialog.

This may be suitable for convincing a user to accept the permission request in order to gain access to a feature, or to reject the request with the knowledge that the feature will not be available.

David Foster
  • 6,931
  • 4
  • 41
  • 42
5

Not possible, since you dont have any control on it whatsoever

Omar Abdelhafith
  • 21,163
  • 5
  • 52
  • 56
4

No you cant change system in built message.because you dont have any control to it.

wasim
  • 698
  • 8
  • 20
4

I don't know if you mean the text under title like this image

enter image description here

If yes, modify your info.plist file. Adding a new key Privacy - User Notifications Usage Description, this is also a Xcode inbuilt option, you can select from menu. Then type what ever text in value.

enter image description here

Here's request code in AppDelegate didFinishLaunchingWithOptions:

if UserDefaults.shared.isFirstLaunch {
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
        if success {
            print("All set!")
        } else if let error = error {
            print(error.localizedDescription)
        }
    }
    UserDefaults.shared.isFirstLaunch = false
}

Roger Lee
  • 200
  • 1
  • 7
0

As Septronic pointed out, at least as of macOS 12.3 / iOS 15.4, the body of the prompt to allow notifications can be customized using the not-really-documented NSUserNotificationsUsageDescription Info.plist key.

You can add a value for the key Privacy - User Notifications Usage Description to your app's Info.plist with the desired string. If you edit the XML Plist directly, use this

<key>NSUserNotificationsUsageDescription</key>
<string>Your description goes here.</string>
MrMage
  • 7,282
  • 2
  • 41
  • 71
-1

System dialog title cannot be customized. But you can customize description message underneath.

Septronic
  • 1,156
  • 13
  • 32
  • 1
    > But you can customize description -- How? – David Foster Jun 10 '22 at 17:40
  • 1
    @DavidFoster I can't edit my post, but you can either add a value for this key `Privacy - User Notifications Usage Description` (if you open as property list), or this (if as source code): ``` NSUserNotificationsUsageDescription ``` – Septronic Jul 11 '22 at 21:01