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.
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.