2016-10-20 11 views

cevap

7

ben bu şekilde elde 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]) 
+2

Not var olan

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { OneSignal.inFocusDisplayType = OSNotificationDisplayType.none return true } 

son çizgiye AppDelegate didFinishLaunchingWithOptions

OneSignal.inFocusDisplayType = OSNotificationDisplayType.none 

aşağıdaki kodu ekleyin kullanımdan kaldırılmış ve 'kOSSettingsKeyInFocusDisplayOption' kullanılmalıdır. d. – jkasten

3

OneSignal, uygulama infocus olduğunda bildirimleri bildirim kutusu olarak gösterir. Bu geçişi kOSSettingsKeyInFocusDisplayOption değerini OSNotificationDisplayTypeNotification veya OSNotificationDisplayTypeNone değeriyle değiştirmek için initWithLaunchOptions üzerindeki ayarlara getirin. AppDelegate sizin didFinishLaunchingWithOptions yöntemde

6

eklemek zorunda. Biz kOSSettingsKeyInAppAlerts` artık `o bu 3 seçenek

public enum OSNotificationDisplayType : UInt { 


/*Notification is silent, or app is in focus but InAppAlertNotifications are disabled*/ 
case none 


/*Default UIAlertView display*/ 
case inAppAlert 


/*iOS native notification display*/ 
case notification 
} 

İşte OneSignal Documentation

0

için kOSSettingsKeyInAppAlerts = NO

[OneSignal initWithLaunchOptions:launchOptions appId:ONESIGNAL_APPID handleNotificationReceived:nil handleNotificationAction:nil 
          settings:@{kOSSettingsKeyInAppAlerts:@NO}]; 
İlgili konular