如何停用观看连接性会话?
我正在使用Apple的WatchConnectivity Framework使用Companion WatchOS应用程序开发iOS应用程序。
On iOS side, after I open the app, I need to manually activate the WCSession
to communicate with the Apple Watch like this
if ([WCSession isSupported]) {
self.wcSession = [WCSession defaultSession];
self.wcSession.delegate = self;
[self.wcSession activateSession];
}
After I finish all necessary communications between the iPhone and the Apple Watch, I want to deactivate wcsession
由于wcsession
的激活是能量消耗的。我已经浏览了WatchConnectivity API,但还没有找到一种停用它的方法。除非我在iPhone上退出应用并再次重新打开该应用,否则我无法关闭连接。
有没有办法停用wcsession
?非常感谢。
I am using Apple's WatchConnectivity framework to develop an iOS app with a companion WatchOS app.
On iOS side, after I open the app, I need to manually activate the WCSession
to communicate with the Apple Watch like this
if ([WCSession isSupported]) {
self.wcSession = [WCSession defaultSession];
self.wcSession.delegate = self;
[self.wcSession activateSession];
}
After I finish all necessary communications between the iPhone and the Apple Watch, I want to deactivate the WCSession
since the activation of WCSession
is energy consuming. I have looked through the WatchConnectivity API but haven't found a way to deactivate it. I cannot shutdown the connection unless I quit the app on the iPhone and reopen it again.
Is there a way to deactivate the WCSession
? Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢@Paulw11,我认为一旦 WCSession 被激活,就无法将其停用。
Thanks to @Paulw11, I think there is no way to deactivate the WCSession once it has been activated.