【问题标题】:UNUserNotificationCenterDelegate willPresent doesn't work with OneSignalUNUserNotificationCenterDelegate willPresent 不适用于 OneSignal
【发布时间】:2017-08-16 23:51:19
【问题描述】:

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

警报现在看起来像这样

【问题讨论】:

    标签: swift apple-push-notifications ios10 onesignal


    【解决方案1】:

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

      OneSignal.initWithLaunchOptions(launchOptions, appId: appID, handleNotificationAction: { (notificationResult) in
    
            }, settings: [kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.notification.rawValue])
    

    【讨论】:

    • 如果有人遇到和我一样的问题,这个设置会保存在存储中,所以如果上面的代码似乎不起作用,只需卸载并重新安装应用程序。
    猜你喜欢
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多