【发布时间】:2017-01-12 07:40:16
【问题描述】:
application:didReceiveLocalNotification: 从 iOS10 开始被弃用,developer page 没有指向任何替代方案。
UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:@"localnotification"
content:content
trigger:trigger];
UNUserNotificationCenter* notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
[notificationCenter requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert)
completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!error) {
NSLog(@"request authorization succeeded!");
}
}];
[notificationCenter addNotificationRequest:request
withCompletionHandler:nil];
我已经创建了一个如上所示的通知,其中包含适当的内容和触发器。现在我希望应用程序在我点击通知时打开,但我似乎无法弄清楚如何。
【问题讨论】:
-
根据要求,我已将我的问题编辑得更具体。重复的可能性不能回答我的问题。
标签: ios objective-c iphone ios10 uilocalnotification