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:

  1. i make call watchkit ios app using openparentapplication:reply:
  2. inside of handlewatchkitextensionrequest:userinfo:reply:, start background task uibackgroundtaskidentifier ensure ios app isn't terminated immediately
  3. i set pfquery , call findobjectsinbackgroundwithblock:
  4. 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

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -