想请问下大家:
UNMutableNotificationContent* content2 = [[UNMutableNotificationContent alloc] init];
content.badge = @2;
content2.body = @“循环时间!”;
content2.sound=[UNNotificationSound defaultSound];
UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:5
repeats:NO];
NSString* requestIdentifer2 = @"NotificationDefault";
UNNotificationRequest* request2 = [UNNotificationRequest requestWithIdentifier:requestIdentifer2
content:content2
trigger:trigger2];
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request2
withCompletionHandler:^(NSError * _Nullable error) {
NSLog(@"Error%@", error);
}];
这个里面的内容都有填写,但是就是无法添加本地通知成功,一直显示是null,请问下是为什么?请大神指教。
有一个没有按照教程设置,就是[UNUserNotificationCenter currentNotificationCenter].delegate = self 无法设置,因为cocos入口是AppController.mm文件!