[英]For Apple Watch OS in Swift, how can I have a function run after WCSession activation is complete?
I have a method in my main interface controller class that I wish to run when the WCSession between the phone and watch has finished activating. 我的主界面控制器类中有一个方法,当电话和手表之间的WCSession完成激活后,希望运行该方法。 I know there is a didFinishActivation function in the WCSession class.
我知道WCSession类中有一个didFinishActivation函数。 However, how do I communicate the result of this function to my main interface controller class to run the function in there, after WCSession has finished activating?
但是,在WCSession完成激活后,如何将该函数的结果传达给我的主接口控制器类以在其中运行该函数?
您必须使您的接口控制器类符合WCSessionDelegate
协议,然后在session(_:activationDidCompleteWith:error:)
WCSession
后将自动调用session(_:activationDidCompleteWith:error:)
函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.