watch os 2 file exchange

I'm trying to send a text data from watchOS 2 to iPhone but found out the hard way that I can no longer use openParentApplication on iOS9. So my next recommended option is to save text into a file and send it via shared groups, which from the watchOS 2 transitioning guide is no longer possible:


"You cannot rely on a shared group container to exchange files with your iOS app. Fetching files involves transferring them wirelessly to Apple Watch."


WatchOS2 transition doc says there are mechanisms to do transfer of a file over network but no specifics or guidance.


"While Apple Watch provides mechanisms to facilitate those transfers, you must update your data-handling code to support those mechanisms."


What are the mechanisms?


I read through the WKInterfaceController doc and header file and didn't see an API to do network file transfer.

You need to use the WatchConnectivity framework

Use the WatchConnectivity framework.


You will need to set up WCSession on both iPhone app and Watch app. After that, you can do live messaging or use 3 offline ways to send: applicationContext, userInfo or file.


More on here:

https://developer.apple.com/library/prerelease/ios/documentation/WatchConnectivity/Reference/WCSession_class/index.html#//apple_ref/occ/cl/WCSession

watch os 2 file exchange
 
 
Q