I try to send the identifier vendor from IOS app to WatchKit extension when the App is Launched or the view has been loaded using watch connectivity and sendMessage method. It works perfectly when I called in event of button ( when clicked on button). But It doesn't work when I called this method in ViewDidLoad. Seem likes It didn't call the sendMessage and I always get empty String from the id Dictionary
override func viewDidLoad() {
super.viewDidLoad()
//Construct wCsession to handle connection between Watch and App
if (WCSession.isSupported()) {
self.session = WCSession.default()
self.session.delegate = self
self.session.activate()
let id = ["id" : uuid]
print(id)
self.session.sendMessage(id, replyHandler: nil, errorHandler: nil)
print("DEVICE ID SENT")
}
}