6

I could not find a solution for this and dumbfounded on this. I have this code :

UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
        UNAuthorizationOptionSound | UNAuthorizationOptionBadge;

[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions
        completionHandler:^(BOOL granted, NSError * _Nullable error) {
             NSLog(@"%i %@",granted, error);
        }];

and then it immediately gets into the call handler without showing the notification permission

2020-09-18 18:05:46.657991-0700 My App [404:9600] 0 Error Domain=UNErrorDomain Code=1 "Notifications are not allowed for this application" UserInfo={NSLocalizedDescription=Notifications are not allowed for this application}

What am i missing? The alert does not even popup.

NOTE: This same code works with no issues on iOS 13.x, on iOS 14 it immediately fails.

user3570727
  • 10,163
  • 5
  • 18
  • 24

4 Answers4

3

My problem was to use Turkish characters in the Product Name section.

https://developer.apple.com/forums/thread/660648

In my case, Build Settings - Packaging - Product Name was not English. Changed to English and worked.

Mahmut K.
  • 707
  • 1
  • 8
  • 20
0

The problem is you omitted a step. Before asking for authorization, call getNotificationSettingsWithCompletionHandler: and look at the authorizationStatus of the resulting object. If it is UNAuthorizationStatusDenied there is no point proceeding.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • There is no notification asked in the first place. Brand new install on the device, and the notification ask never comes up. Systems settings does not even notification setting for the app. – user3570727 Sep 19 '20 at 06:36
  • Sorry, to be clear, the above code is required yes, but in this case as it is a fresh install it is moot – user3570727 Sep 19 '20 at 13:22
0

My product name was in Japanese. When the product name is non-english the above issue happens! If I change the product name to English it works! I have filed an issue via Apple Feedback Assistant.

user3570727
  • 10,163
  • 5
  • 18
  • 24
  • Did anyone figure this out. I am having the same problem. My app's name is mylittleworldapp so even though this is not a foreign name it is not necessarily English either. Will try solution and see. – user1114881 Mar 27 '21 at 22:37
0

I had the same problem. The other posters are right that it seems to be a non-English character in the app name (mine was ñ), for some reason that's disallowed.

To get around it I added CFBundleDisplayName to my plist and put the app's "correct" name (with the ñ) in there, and removed that character from the ${PRODUCT_NAME}.

brooks42
  • 139
  • 3