新的iOS 8环境中,远程推送注册已经采用了新的方法,之前的办法失效了:(如下)
[[UIApplicationsharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
如果升级你的应用,现在应该为iOS 8环境考虑了,要采用下面新的办法:
NSSet *categories = nil;
[[UIApplicationsharedApplication] registerForRemoteNotifications];
[[UIApplicationsharedApplication] registerUserNotificationSettings:[UIUserNotificationSettingssettingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSoundcategories:categories]];
如果你还不知道怎么构造 categories,那暂时使用 nil 值吧。