objective c - PFQuery findObjectsInBackgroundWithBlock: in WatchKit app works in simulator, not on watch unless iOS app is in foreground -
i'm writing watchkit app needs make query our parse server. because network call, follow following procedure:
- i make call watchkit ios app using
openparentapplication:reply: - inside of
handlewatchkitextensionrequest:userinfo:reply:, start background taskuibackgroundtaskidentifierensure ios app isn't terminated immediately - i set
pfquery, callfindobjectsinbackgroundwithblock: - in block pass pfquery, reply relevant information watch
i wrote app maybe month ago before apple watch out, , ran fine in watch simulator. yesterday received apple watch , able app running on watch, doesn't quite work - managed figure out when ios app actively running in foreground on iphone, great; if app not active (e.g. backgrounded or terminated), findobjectsinbackgroundwithblock: never calls block, , execution seems stop.
does have ideas of might going on? initial thought ios app getting suspended/killed before can complete query, pretty sure background task prevent that.
ps. if stumbles upon question because looking how watchkit app running on actual watch, found this post extremely helpful in getting working.
turned out had several problems related openparentapplication:reply:, , seem have been resolved using technique post:
http://www.fiveminutewatchkit.com/blog/2015/3/11/one-weird-trick-to-fix-openparentapplicationreply
i had started background task own app, didn't use "bogus workaround" background task described in post, because wasn't necessary me in simulator. on watch, though, apparently was.
Comments
Post a Comment