小编Rus*_*lan的帖子

APNS 以“DeviceTokenNotForTopic”为由拒绝通知

我仅在尝试使用 UserNotifications 框架注册远程通知时收到此错误。使用 PushKit 时一切正常。

    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];
Run Code Online (Sandbox Code Playgroud)

从 Xcode 11 和 iOS13 开始,PushKit 发生了变化以支持 CallKit,因此我尝试使用 UserNotifications 代替,如Apple 文档中所述

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 …
Run Code Online (Sandbox Code Playgroud)

objective-c apple-push-notifications ios pushkit usernotifications

5
推荐指数
1
解决办法
1万
查看次数