【发布时间】:2014-10-10 10:07:23
【问题描述】:
我正在尝试为 Ipad 注册推送通知,但没有任何运气。我尝试了以下代码,但在 IOS8 上出现错误“registerForRemoteNotificationTypes:iOS 8.0 及更高版本不支持”。虽然它在 IOS7 上运行良好。
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
NSLog(@"+++++++++++++");
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
NSLog(@"============");
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
【问题讨论】:
标签: objective-c cordova ios7 push-notification ios8