Communicating with WCSession
WatchKit on watchOS 2 brings major improvements to how Apple Watch apps communicate with their host app. Gone is openParentApplication(_:reply:), which has been replaced by the more capable WCSession.
WCSession allows WatchKit apps and their counterpart application to communicate, bidirectionally, in three ways: an updatable Application Context, live messages, and background transfers. The two later communication methods can either send a dictionary of values or raw data.
The Application Context is a dictionary that’s sent to the counterpart and persisted. The dictionary can then be read when the counterpart, whether that’s the WatchKit app or the host app, wakes up.
Updating the Application Context is simple. Just call updateApplicationContext(_:). This replaces the prior context value visible to the counterpart application. Note that
Continue reading →