注册

ios10都不用原来的推送了,换成了usernotifications.framework框架,但是SDK的demo里还是原来的ios10之前的方式注册,能行么

最新的不应该是这样么,用usernotifications.framework来registerUserNotificationSettings么,现在ios10收不到推送通知了,同样的项目,ios10之前可以

//iOS 10 before

 UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; [application registerUserNotificationSettings:settings];


//iOS 10 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@"request authorization succeeded!"); } }];
 
已邀请:
你可以按照iOS 10的方法去注册推送。

要回复问题请先登录注册