小编Tar*_*rek的帖子

如何在处理通知时防止 IOS Swift 上的 OneSignal 打开 WebView

我正在处理我原来的 webview 中的 LunchUrl 但问题是当我把 kOSSettingsKeyInAppLaunchURL

[ true] 它在我原来的 webview 上打开新的 webview

[ false] 它在 safary 中打开链接

let notificationOpenedBlock: OSHandleNotificationActionBlock = { result in
    let payload = result?.notification.payload
    if let additionalData = result!.notification.payload!.additionalData {
        // DEEP LINK and open url in RedViewController
        centerViewController.receivedURL = payload!.launchURL as! String!

        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = centerViewController
        self.window?.makeKeyAndVisible()
    }
}

OneSignal.initWithLaunchOptions(launchOptions, appId: "*****", handleNotificationReceived: { (notification) in
    }, handleNotificationAction: notificationOpenedBlock , settings: [kOSSettingsKeyAutoPrompt : true, kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.notification.rawValue, kOSSettingsKeyInAppLaunchURL: true])
Run Code Online (Sandbox Code Playgroud)

uiwebview push-notification ios swift onesignal

5
推荐指数
1
解决办法
1295
查看次数

标签 统计

ios ×1

onesignal ×1

push-notification ×1

swift ×1

uiwebview ×1