iOS 12 前台通知shouldAlwaysAlertWhileAppIsForeground崩溃问题

iOS12后,前台通知中blog

shouldAlwaysAlertWhileAppIsForeground不能使用了,若是仍是it

 [content setValue:@(YES) forKeyPath:@"shouldAlwaysAlertWhileAppIsForeground"]则会崩溃io

 

解决办法:class

Appdelegate中添加:notification

//iOS 12
-(void) userNotificationCenter:(UNUserNotificationCenter*)center willPresentNotification:(UNNotification*)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
    completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
}

 

建立前台通知时不设置di

shouldAlwaysAlertWhileAppIsForeground属性。co

相关文章
相关标签/搜索