iOS 8テストローカルプッシュで問題が発生

2131 ワード

xcoceはいつもこの間違いを報告している.
{fire date = Friday, February 6, 2015 at 5:42:00 PM China Standard Time, time zone = (null), repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Friday, February 6, 2015 at 5:42:00 PM China Standard Time, user info = (null)} with an alert but haven’t received permission from the user to display alerts
 
原因を分析する
apiが変わった
  
/*

 :

1 Attempting to schedule a local notification

2 with an alert but haven't received permission from the user to display alerts

3 with a sound but haven't received permission from the user to play sounds

*/

//ios8 , APP  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // window  //ios8    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {   UIUserNotificationSettings *noteSetting =[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound                     categories:nil];   [[UIApplication sharedApplication] registerUserNotificationSettings:noteSetting];  } }