我正在開發一個iOS應用程序,我希望所有具有iOS 7的手機都能夠使用該應用程序。當我將它設置爲iOS 7時,有三種方法無法使用,因爲它們僅適用於iOS 8和更新版本。有誰知道舊的方法。這裏是有錯誤的代碼...需要iOS 7的相同方法
let settings = UIUserNotificationSettings.init(forTypes: [.Sound, .Alert, .Badge], categories: nil) //Error: UIserNotificationSettings is only available on iOS 8 and newer
application.registerUserNotificationSettings(settings) //Error: registerUserNotificationSettings is only available on iOS 8 and newer
application.registerForRemoteNotifications() //Error: registerForRemoteNotifications is only available on iOS 8 and newer
這可能會指導您http://corinnekrych.blogspot.mx/2014/07/how-to-support-push-notification-for.html –