UNUserNotificationCenterDelegate willPresent不能与OneSignal合作

时间:2017-03-24 06:23:59

标签: swift apple-push-notifications ios10 onesignal

我使用OneSignal发送推送通知,我遇到的问题是,在iOS 10上,方法功能userNotificationCenter (_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)不起作用,并显示UIAlertController,而不是标准横幅。我需要做什么才能使此方法在iOS 10上运行并显示标准横幅?

警报现在看起来像这样 enter image description here

1 个答案:

答案 0 :(得分:2)

我被提示解决此问题here。它有效。

  OneSignal.initWithLaunchOptions(launchOptions, appId: appID, handleNotificationAction: { (notificationResult) in

        }, settings: [kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.notification.rawValue])