Push notification error after update to iOS 14

Recently after iOS 14 have been released, I tested our app and I'm facing with an error when it try to get the request authorization for the push notification permission, always I get the follow error:

Error Domain=UNErrorDomain Code=1 "Notifications are not allowed for this application" UserInfo={NSLocalizedDescription=Notifications are not allowed for this application}

The message for the request authorization is never showed and I alway get the error.

In iOS 13 this work perfectly, this is happening only in iOS 14.
The only thing is that my app product name has the symbol "Ⓡ" in the name. I've deleted it but is not working.
The product has the capability to push notification in apple developer site and in the configuration file.

Some one that had faced with same error and has found some solution?

This is part of my code to register remote notifications:

UNUserNotificationCenter.current().getNotificationSettings(completionHandler: { settings in
if settings.authorizationStatus == .notDetermined {
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions) { granted, error in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
} else {
if let error1=error {
print("Error ->\(error1.localizedDescription)")
}
}
}
} else if settings.authorizationStatus == .denied {
//
} else if settings.authorizationStatus == .authorized {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
})

I think is an iOS 14 issue, because I found some other post where are describing the same issue.

Thanks.












Replies

same here :( Did you found any solutions mate ?
I have the same issue , Any solutions?
I found a Solution!
I created a new application with the same app bundle Id that my application that is not working. After that, I tested that push notifications were working in the new test app in iOS 14.
I compare the two projects(.pbxproj in text file mode) and I found some difference in the section /* XCBuildConfiguration section */,
specifically in the follow parameters(Debug and Release configuration):
CODESIGNIDENTITY = "Apple Development";
CODESIGNSTYLE = Automatic;
For some reason, there were with other values. After put the same values that my Test App, the problem disappered and I was able to get the push notification permission again.
I you can read in the Apple help, they mention that you have to have a valid developer account to test push notifications, and I think that the problem was because the signing configuration were bad and for some reason in Xcode 11 and iOS 13 was working.

Some other people in other threads were able to fix the problem only changing the product name to English, but sincerely is very strange this solutions and it not worked for me. But is more strange the behavior of this problem when your application is working in iOS 13 version and all I did to fix the problem.










hi @mferia , CODESIGNIDENTITY = "Apple Development";
CODESIGNSTYLE = Automatic; is the right way or the wrong way , and what do you mean with "only changing the product name to English" , thanks!!!
I solved it by changing the Product Name in Build Settings from Korean to English.
It was only a problem with iOS14.

So, <korean>.app in the "Products" folder has been changed to <english>.app.

And, clean & rebuild !, delete App & reinstall !!
Hi @jdiestram.
About your questions, the follow parameters were the right way:

specifically in the follow parameters(Debug and Release configuration):
CODESIGNIDENTITY = "Apple Development";
CODESIGNSTYLE = Automatic;


And for your last question:
and what do you mean with "only changing the product name to English"?
I've been doing more investigation about it and my conclusion is that if you have special characters or another non standard character that are not part of the standard English in the Product Name(Select the Project->Target->Build Settings), you're going to get the error of the push notifications.
And then, for fix the root problem, you only have to replace the Product Name by the General Variable $(TARGET_NAME).
If your file ProjectTargetName.entitlements has the special characters that were part of the old product name, please be sure to recreate it. I did it removing first the file and recreating all app capabilities(deleting and adding all again in Project->Target->Signing and capabilities), It will create the entitlements file again.

Rebuild and test your app.

Remember that the product name is not the display name. It is configured in Info project section.

I hope that it can help you.






As some of you have found out, this issue is is being caused on iOS 14 if the Product Name (not the Display Name) contain certain characters. Unfortunately this issue causes problems with the complete alphabets of several languages, as well as certain special characters.

If you encounter this issue, you will see two distinct errors related to User Notifications.

1- When you call
Code Block
UNUserNotificationCenter.current().requestAuthorization()
you will encounter the error
Code Block
Error Domain=UNErrorDomain Code=1 "Notifications are not allowed for this application"


2- If you are using Push Notifications, when you call  
Code Block
UIApplication.shared.registerForRemoteNotifications()
you will get a callback to
Code Block
application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
but the error will be nil, and if you are using the error parameter without checking, you may encounter a crash at this point.

The workaround for this at this time is to only use simple ASCII characters in your Product Name and use the string you want displayed in the Display Name

The Product Name (which can be set in Xcode project -> Build Settings -> Packaging) is not a user visible entity.

You can change the Display Name (aka Bundle Display Name in Info.plist) to the string that you want displayed under the app icon, and also with the displayed notifications.

In order for this name change to take, you may need to delete the app first, and install the new build.

If your app is localized to multiple languages, you can still use the strings as you wish to be displayed by localizing the Display Name.








solution:-
xcode -> file -> new -> target.. -> notification service extansion -> Next -> fill up all the value -> activete
  • What does this do?

Add a Comment
Hi,
I also had same issue..I changed the Product name and issue is gone. It's weird but it is working.