WatchOS2 WCSession How many delegates can the WCSession have in WatchKitExtension?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 17:35:42

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!