[[UIApplication sharedApplication] registerForRemoteNotifications];
但是,既没有调用“dIDRegisterForRemoteNotificationWithDevicetoken”或“dIDFailToRegisterForRemoteNotificationsWithError”.此外,我的应用程序没有出现在Settings-> Notifications部分(告诉我它甚至没有尝试注册远程/推送通知)
我的应用程序ID启用了以下应用程序服务:
>游戏中心
>应用内购买
>推送通知
在Xcode中,启用了以下功能:
>推送通知
>背景模式(远程通知)
这适用于iOS 8,应用程序使用Xcode 6构建.此外,当使用Xcode 7构建时,它不再适用于iOS 8设备.
解决方法 你使用模拟器吗?在模拟器中,不支持远程通知.
示例代码:
func application(application: UIApplication,dIDFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let pushSettings = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Badge,UIUserNotificationType.sound,UIUserNotificationType.Alert],categorIEs: nil) application.registerUserNotificationSettings(pushSettings) return true}func application(application: UIApplication,dIDRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) { application.registerForRemoteNotifications()}func application(application: UIApplication,dIDRegisterForRemoteNotificationsWithDevicetoken devicetoken: NSData) { let token=devicetoken.description print(token)}func application(application: UIApplication,dIDFailToRegisterForRemoteNotificationsWithError error: NSError) { print(error)}
Xcode说:
Error Domain=NSCocoaErrorDomainCode=3010 "REMOTE_NOTIFICATION_SIMulATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION"UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMulATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}总结
以上是内存溢出为你收集整理的推送通知 – 无法注册推送通知(Xcode 7,iOS9)全部内容,希望文章能够帮你解决推送通知 – 无法注册推送通知(Xcode 7,iOS9)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)