iOS8 本地通知使用方法

来源:互联网 发布:java时间相减 编辑:程序博客网 时间:2024/05/17 05:58
/*报错信息可能如下:1 Attempting to schedule a local notification2 with an alert but haven't received permission from the user to display alerts3 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];  }}

0 0
原创粉丝点击