How do I prevent Alert when App is on Foreground with Incoming OneSignal Push Notification?

后端 未结 4 1853
失恋的感觉
失恋的感觉 2021-01-12 08:33

When my app is in the foreground, there is a alert that appears. How do I prevent this from appearing when receiving push notifications?

4条回答
  •  隐瞒了意图╮
    2021-01-12 08:47

    For Swift 3.0

    // Initialize OngeSignal with Settings for Push Notifications
        OneSignal.initWithLaunchOptions(launchOptions, appId: Constants.OneSignalAppID, handleNotificationReceived: nil, handleNotificationAction: {
            (result) in
            // Do Something with Notification Result
        }, settings: [kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.none.rawValue])
    

提交回复
热议问题