Sto cercando di ottenere analizzare le notifiche push che lavorano sulla mia app (tutto veloce), ma durante il tentativo di implementare, ottengo l'errore 'PFInstallation' does not have a member named 'saveInBackground'
Parse Notifiche Push - Installazione Swift non funziona
Ecco il mio codice.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.setApplicationId("APP ID HIDDEN", clientKey: "CLIENT ID HIDDEN")
// let notificationTypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
//let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
var notificationType: UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationType, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
//UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
// Override point for customization after application launch.
return true
}
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings!) {
UIApplication.sharedApplication().registerForRemoteNotifications()
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
var currentInstallation: PFInstallation = PFInstallation()
currentInstallation.setDeviceTokenFromData(deviceToken)
currentInstallation.saveInBackground()
println("got device id! \(deviceToken)")
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
println(error.localizedDescription)
println("could not register: \(error)")
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
}
quando cambio la currentInstallation.saveInBackground
al currentInstallation.saveEvenutally()
, il codice viene compilato bene ..
Ma quando si cerca di accedere con successo per le notifiche push, un errore si apre nella console dicendo Error: deviceType must be specified in this operation (Code: 135, Version: 1.4.2)
I ho passato ore a cercare di capirlo, nessun dado, ogni aiuto è apprezzato.
Questo ancora non lo aggiusta per me :(, facendo questo + var currentInstallation: PFInstallation = PFInstallation.currentInstallation() ha funzionato – yoshyosh
'import Bolts' Questo è il –