I'm receiving this error only when trying to register for remote notifications using UserNotifications framework. When using PushKit everything works ok.
dispatch_queue_t mainQueue = dispatch_get_main_queue();
// Create a push registry object
self.voipRegistry = [[PKPushRegistry alloc] initWithQueue: mainQueue];
// Set the registry's delegate to self
self.voipRegistry.delegate = self;
// Set the push type to VoIP
self.voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
Since Xcode 11 and iOS13 there are changes in PushKit to support CallKit, so I'm trying to use UserNotifications instead, as described in Apple's documentation
Important
If you are unable to support CallKit in your app, you cannot use PushKit to handle push notifications. Instead, configure your app's push notification support with the UserNotifications framework.
I'm registering for remote notifications this way
- (BOOL) application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
And receiving token:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
But when I'm sending notification from my server, I get DeviceTokenNotForTopic. I'm not sure, if UserNotifications framework uses different APNs server or token format is different.
Use the location push type for notifications that request a user's location. If you set this push type, the apns-topic header field must use your app's bundle ID with . location-query appended to the end. For more information, see Creating a Location Push Service Extension.
Obtain a Provider Certificate from Apple Select Apple Push Notification service SSL (Sandbox & Production) for the type and click Continue. Select the App ID (also known as Bundle ID) of your app and click Continue. Generate a Certificate Signing Request (CSR) on your server. Click Continue.
APNS sends such error if bundleID of your app different from the apns-topic
that you are sending from the server in request for voip push.
Or a certificate for a voip push is generated for another bundleID.
Error code https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html More discussions here. https://github.com/QuickBlox/quickblox-ios-sdk/issues/1020
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With