Why doesn't print() work when sending a message via Apple Watch To iPhone?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Why doesn't print() work when sending a message via Apple Watch To iPhone?



I am learning how to create a companion Watch App for an iPhone app. (Everything is being done on the simulator)



I am sending a message when I tap a button on the Watch app.


session.sendMessage(["Message": "It Worked" ], replyHandler: nil) { (error) in
print(error)
}



Then I receive the message in ViewController.swift:


func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
print(message["Message"])
print("!!!!")
theLabel.text = message["Message"] as! String

}



Neither print function fire. However I know I am getting the message because my label is being updated. Break points also don't work in this function. If I put another function call in the didRecieveMessage function it will fire.



Is this a bug? It made me think my message wasn't being sent for the longest time because I was just trying to see if the function was firing via print() and breakpoints.



If not a bug, why doesn't print() work?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived