IOS*_*Dev 15 apple-push-notifications ios13 xcode11
我有与 APNS 设备令牌相关的问题。在我使用 Xcode 10.2 和 iOS 12.1 之前。此时我曾经在委托方法中获取设备令牌
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
Run Code Online (Sandbox Code Playgroud)
我正在像这样注册 APNS,它运行良好。
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
if(!error){
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
}];
Run Code Online (Sandbox Code Playgroud)
现在,当将 iOS 13 安装到我的 iPhone 设备并使用 Xcode 11 时,不会调用委托方法 didRegisterForRemoteNotificationsWithDeviceToken。无法理解这个问题。我已经对此进行了研究,我知道从委托方法获取令牌有一些变化,但在我的情况下,委托方法甚至没有被调用。同样,它在 iOS 12 上运行良好。
小智 -2
对于部署设备使用的平台版本,这与您的 XCode 安装中缺少 DeviceSupport 有关。
就我而言,13.1 平台缺失。要解决此问题,只需在文件夹中添加 DeviceSupports
Xcode.app/Contents/Develper/Platforms/iPhoneOS.platform/DeviceSupport
您可以从以下位置下载缺少的 DeviceSupport: https://github.com/iGhibli/iOS-DeviceSupport/tree/master/DeviceSupport
| 归档时间: |
|
| 查看次数: |
10218 次 |
| 最近记录: |