iOS12后,前台通知中
shouldAlwaysAlertWhileAppIsForeground不能使用了,如果还是
[content setValue:@(YES) forKeyPath:@"shouldAlwaysAlertWhileAppIsForeground"]则会崩溃
解决办法:
Appdelegate中添加:
//iOS 12
-(void) userNotificationCenter:(UNUserNotificationCenter*)center willPresentNotification:(UNNotification*)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
}
创建前台通知时不设置
shouldAlwaysAlertWhileAppIsForeground属性。
转载于:https://www.cnblogs.com/Ganggang888/p/9706279.html
最后
以上就是酷酷花卷最近收集整理的关于iOS 12 前台通知shouldAlwaysAlertWhileAppIsForeground崩溃问题的全部内容,更多相关iOS内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复