我希望能有在iOS 7和iOS 8通知,我已经建立了其与iOS8上的成功,但这个iOS的7我得到的上线只是“LLDB”没有别的错误“变种mySettings ......”。 从我读过这是什么,你是如何打算注册它在iOS 7,但似乎并没有工作!
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> bool{
//check if its on ios8
var deviceVersion : NSString = UIDevice.currentDevice().systemVersion
if deviceVersion.floatValue >= 8.0 {
//I've set up the iOS 8 notifications here and that all works.
}else{
var types : UIUserNotificationType = UIUserNotificationType.Badge | UIUserNotificationType.Alert;
var mySettings : UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(mySettings)
}
return true
}