我將Xcode升級到Xcode 6.0.1,現在iOS8設備沒有發生遠程通知註冊。它適用於iOS 7設備。爲什麼應用程序未在iOS 8中註冊推送通知?
我已經加入在應用程序代理的代碼如下所述:
//-- Set Notification
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
NSLog(@"current notifications : %@", [[UIApplication sharedApplication] currentUserNotificationSettings]);
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
即使當前通知存在,並且它不是零。
然而下面的方法不叫:下面
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
截圖解釋說,我已經啓用的後臺模式的某些選項:
和通知在設備設置我的應用程序的設置。
非常感謝。現在,該應用正在成功註冊推送通知。 – user1899840 2014-09-26 08:04:28