2015-11-17 96 views
0

我在我的项目中集成了Azure通知。在iOS 8.3之上的iOS 8.3通知无法正常工作的推送通知。 这是我的代码的AppDelegate代码示例:推送通知不工作ios 8.3?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    if(([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)){ 
     UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge 
                          |UIRemoteNotificationTypeSound 
                          |UIRemoteNotificationTypeAlert) categories:nil]; 
     [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; 
    }else{ 
     UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; 
     [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes]; 
    } 

} 
+0

你必须使用第三方(Azure的通知)类? –

+0

是Rohit。我正在使用WindowsAzureMessaging.Framework。 – Anbu

回答

4

尝试下面的代码,它可能会帮助

if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { 
     // iOS 8 Notifications 
     [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; 

     [application registerForRemoteNotifications]; 
} else { 
     // iOS < 8 Notifications 
     [application registerForRemoteNotificationTypes: 
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; 
    } 
+0

我使用此代码,但不工作@ PiyushSharma.notification只接收ios 9。 – Anbu