我正在实现 Apple Watch。在我的 Watchkit 扩展中,我使用该方法与“主应用程序”通信。
[WKInterfaceController openParentApplication:applicationData reply:^(NSDictionary *replyInfo, NSError *error) {}];
根据苹果documentation ,应用可以在后台处理请求。
When you call the openParentApplication:reply: method, iOS launches or
wakes up the parent app in the background and calls the
application:handleWatchKitExtensionRequest:reply:method of its app delegate.
但是我的应用程序始终处于事件状态,即使方法中没有代码,handleWatchKitExtensionRequest
有什么建议吗?
提前致谢
最佳答案
根据 Apple Developer Forum 上 Apple dev 的官方回复,这是 WatchKit Framework Beta 2 中的错误。
https://devforums.apple.com/message/1082689#1082689
And just to be clear about one thing, the iPhone app is lauched in the background. In the simulator currently the app is being launched in the foreground. This will not be the experience on device. The documentation specifically says, "Calling the method causes iOS to launch the app in the background ...".
(帖子编号 6)
顺便说一句,昨天 Beta 3 发布了,也许它已经修复了。
此外,如果 iPhone 将被锁定,您的 iOS 应用程序也将在后台启动。
关于ios - Apple Watch 和 openParentApplication 在后台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27531937/