My iOS app sends timely information via the WatchConnectivity framework. The receiving side implements the delegate of WCSession.
I have 2 interfaceControllers that need the information sent from the WCSession.
One is the glanceInterfaceController and the other is my mainInterfaceController.
Can both of them be assigned the delegate and both receive the userInfo or applicationContext sent from my iOS app at the same time? or can there only be one WCSession delegate assigned and my controllers need to get the data from the object that is assigned?
Thanks!
WCSession only supports a single delegate at a time. If you want multiple parts of your code to be notified when there is new incoming content you'd have to either create a wrapper class that has similar callbacks to the WCSessionDelegate but supports multiple observers or you could use local notifications to forward the contents on. Perhaps better; have your WCSessionDelegate update the app's data store and then notify the parts of your code reading from the data store that it has been updated so they'll refresh their views?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With