Lorenzo
Lorenzo

Reputation: 3387

WatchKit get data from closed App in iPhone

There are some applications (example Runtastic) where is possible from the Watch to activate some function of the companion App even if the App is not running in the iPhone (never opened or closed). How is possible to make the same with my Apps (get general data or settings)? I read some documents from Apple about app in background but I don't find nothing about App closed. Can someone help me? Thanks in advance

Upvotes: 1

Views: 570

Answers (1)

imas145
imas145

Reputation: 1979

You have a few choices here: open the parent iPhone app to the background using openParentApplication:reply: in WKInterfaceController, use shared app containers or use app groups to share NSUserDefaults and keychain items. This will work for WatchKit 1 apps and here is an article on how to use these (+ MMWormhole): http://www.kristinathai.com/watchkit-best-practices-for-sharing-data-between-your-watch-and-ios-app/

One thing to keep in mind is when watchOS 2 launches later in this fall, this won't work with WatchKit 2 apps anymore. There you need WCSession, but that is a completely different thing and question.

Upvotes: 1

Related Questions