Tuesday, 15 July 2014

Parse Push Notifications - Swift Installation Not Working -



Parse Push Notifications - Swift Installation Not Working -

i trying parse force notifications working on app (all swift) while trying implement, error 'pfinstallation' not have fellow member named 'saveinbackground'

here code.

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { parse.setapplicationid("app id hidden", clientkey: "client id hidden") // allow 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 customization after application launch. homecoming 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) }

when alter currentinstallation.saveinbackground currentinstallation.saveevenutally() , code compiles fine..

but when trying sign force notifications, error pops in console saying error: devicetype must specified in operation (code: 135, version: 1.4.2)

i have spent hours trying figure out, no dice, help appreciate.

to else has error, create sure import bolts framework bridging header file

which isn't outlined in crap docs.

that fixes issue.

below code.

#import <parse/parse.h> #import <bolts/bolts.h>

just add together bridging header go. thanks

swift notifications parse.com push

No comments:

Post a Comment