2016-04-27 44 views
0

我使用與IOS的iphone 9.3IOS 9推送通知 - didRegisterForRemoteNotificationsWithDeviceToken不是呼叫

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    // Override point for customization after application launch. 

    UIUserNotificationType types = (UIUserNotificationType) (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert); 

    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil]; 

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; 

    return YES; 
} 

通知登記此方法後是呼叫:

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings 
{ 
    //register to receive notifications 
    [application registerForRemoteNotifications]; 
} 

的[應用registerForRemoteNotifications]之後,出現系統彈出窗口,我接受通知但方法:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *) deviceToken 

永遠不會打電話,我錯過了什麼?

這在iOS 8

+0

你添加正確的權利? – EmilioPelaez

+0

您是否實現了didFailToRegisterForRemoteNotifications並看到它是否被調用? – Gruntcakes

+0

didFailToRegisterForRemoteNitifications未被調用...但didRegisterUserNotificationSettings正在調用 – Jordan

回答