0

I want to send data from iWatch to iPhone if my watch is in the background and iPhone app is in the foreground. I transferring data by timer method. It is calling each second. WCSessionDelegate methods implemented both files iPhone app file and watch kit extension file. WCSessionDelegate method didReceiveUserInfo, didReceiveMessage, didReceiveMessage replyHandler implemented.

let applicationData = ["class":"progress", "mode":"steps"]
WCSession.default.transferUserInfo(applicationData as [String : AnyObject])
Rakesh Patel
  • 1,673
  • 10
  • 27

1 Answers1

2

The issue resolved by me after some trials and play with code, earlier I had Configured and Activated the WCSession in viewDidLoad method of ViewController which I found out is not recommended by Apple and their recommendation says that we should always set up of WCSession very early in application's lifecycle at both(iWatch and iPhone) end. This will work smoothly if we activate it in AppDelegate and ExtensionDelegate.

For reference, you can see https://developer.apple.com/videos/play/wwdc2015/713/