ios - Parse Local DataStore not showing pinned data -
i have tried make sure recommended steps followed in implementing parse local data store either pinning seems not working or querying pinned objects not working. have tried multiple options. below code view controller , have enabled datastore etc in app delegate file (using base parse starter project). please advise me problem.
output in console - able fetch data parse server either not able pin or retrieve or else..
success 8888 optional([]) push notifications not supported in ios simulator. success 7777 optional([<restaurant: 0x7f98ca521f60, objectid: 0rrzncndje, localid: (null)> { name = time; }])
thanks help!
import foundation import parse import parseui import uikit import foundation class restaurantadmin: viewcontroller { func getdatafromlocaldatastore() { var username = pfuser.currentuser()?.username var messages2: [anyobject]! var query2: pfquery = pfquery(classname: "restaurant") query2.fromlocaldatastore() query2.wherekey("owner", equalto: username!) query2.findobjectsinbackgroundwithblock { (objects, error) -> void in if (error == nil) { messages2 = objects println(" success 8888 ") println(objects) } else { println("fail 8888") } } } func refreshrestaurantdatafromserver() { var username = pfuser.currentuser()?.username var query = pfquery(classname: "restaurant") query.wherekey("owner", equalto: username!) query.selectkeys(["name"]) var messages: [anyobject]! query.findobjectsinbackgroundwithblock { (objects, error) -> void in if (error == nil) { pfobject.pinallinbackground(objects, block: nil) println("success 7777") println(objects) } else { println("error 7777") } } } override func viewdidappear(animated: bool) { super.viewdidappear(animated) if (pfuser.currentuser()?.username != nil) { refreshrestaurantdatafromserver() } getdatafromlocaldatastore() } }
since using query.selectkeys(["name"])
whole object not downloaded. saving partial object , querying using query2.wherekey("owner", equalto: username!)
. saved object not contain "owner"
key.
Comments
Post a Comment