2016-11-09 22 views
1

我想知道我是否可以允許我的應用程序同時支持ios 9和ios 10通知?Swift onesignal我可以允許我的應用程序支持ios 9和ios 10通知嗎

我只是集成onesignal通知服務到應用中,看着,如果我想允許進入的通知我的應用我只能支持ios9或者我可以幫助那些支持視頻/ GIF格式等

所以ios10部分ios 10也是如此,我的意思是如果通知回落到ios 9風格,如果設備運行的話。

現在我有這樣的:

OneSignal.initWithLaunchOptions(launchOptions, appId: "myId", handleNotificationReceived: { (notification) in 
      print("Received Notification - \(notification?.payload.notificationID)") 
     }, handleNotificationAction: { (result) in 

      // This block gets called when the user reacts to a notification received 
      let payload = result?.notification.payload 
      var fullMessage = payload?.title 

      //Try to fetch the action selected 
      if let additionalData = payload?.additionalData, let actionSelected = additionalData["actionSelected"] as? String { 
       fullMessage = fullMessage! + "\nPressed ButtonId:\(actionSelected)" 
      } 
      print(fullMessage) 
     }, settings: [kOSSettingsKeyAutoPrompt : true, kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.notification.rawValue]) 

if #available(iOS 10.0, *) { 
      UNUserNotificationCenter.current().getNotificationCategories { (categories) in 
       let myAction = UNNotificationAction(identifier: "actionSelected", title: "Hit Me!", options: .foreground) 
       let myCategory = UNNotificationCategory(identifier: "myOSContentCategory", actions: [myAction], intentIdentifiers: [], options: .customDismissAction) 
       let mySet = NSSet(array: [myCategory]).addingObjects(from: categories) as! Set<UNNotificationCategory> 
       UNUserNotificationCenter.current().setNotificationCategories(mySet) 
      } 
     } 

回答

0

如果設置OneSignal的儀表板或REST API的iOS的10家媒體的連接仍然會沒有附件發送到iOS 9和舊設備。

相關問題