【发布时间】:2017-08-07 10:27:13
【问题描述】:
在 iOS 10.3 中,我将代码添加到 AppDelegate:
@interface AppDelegate () {
UNUserNotificationCenter *center;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
center = [UNUserNotificationCenter currentNotificationCenter];
UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
[center requestAuthorizationWithOptions:options
completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!granted) {
DLog(@"Something went wrong");
} else {
DLog(@"Access Granted")
}
}];
return YES;
}
我点击了通知,但是下面的方法没有被调用。
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
【问题讨论】:
标签: ios10 uilocalnotification appdelegate