0
我正在嘗試將OneSignal集成到我的應用程序中。 我想要的是當用戶點擊一個通知以模態呈現所需的ViewController。我在執行OneSignal初始化時在handleNotificationAction
中實施了打開VC邏輯。 問題是OneSignal仍然打開它的WebView,我不希望它。有什麼方法可以在用戶點擊通知時禁用打開WebView?如何在處理通知時禁止OneSignal打開WebView
let onesignalInitSettings = [kOSSettingsKeyAutoPrompt: false]
OneSignal.initWithLaunchOptions(launchOptions,
appId: "myAppID",
handleNotificationAction: { result in
guard let payload = result?.notification.payload else { return }
guard let additionalData = payload.additionalData else { return }
guard let venueID = additionalData["internal"] as? String else { return }
DispatchQueue.main.async {
self.showVenueDetails(venueID)
}
},
settings: onesignalInitSettings)
OneSignal.inFocusDisplayType = .notification
OneSignal.promptForPushNotifications(userResponse: { accepted in
print("User accepted notifications: \(accepted)")
})