關於iOS8上本地通知接收不到的問題

在iOS8系統開發使用本地通知時,會出現以下的相關提示語:app

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開發

……it

緣由在於在iOS8系統上須要註冊本地通知,這樣才能正常使用io

 

// iOS8註冊本地通知select

if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)])notification

{di

    [application registerUserNotificationSettings:[UIUserNotificationSettingssettingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSoundcategories:nil]];sse

}display

相關文章
相關標籤/搜索