【发布时间】:2016-07-28 13:44:45
【问题描述】:
我的应用突然无法生成设备令牌。 我创建了一个应用程序来接收远程推送通知,该应用程序运行良好,但是今天我的应用程序不生成设备令牌,我在 xcode 上运行代码并且不生成令牌。没有调用委托方法。 我没有改变任何东西,也没有更多地工作。函数 didRegisterForRemoteNotificationsWithDeviceToken 不起作用。看:
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
print(deviceToken)
}
什么都不打印
这个函数什么都不做:
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print(error)
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// Override point for customization after application launch.
let types:UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: types, categories: [newsCategory]))
return true
}
为什么会出现这个问题?我该如何解决?
【问题讨论】:
标签: swift2 apple-push-notifications