ios - Apple Watch 和 openParentApplication 在后台

标签 ios watchkit apple-watch

我正在实现 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/

相关文章:

ios - 如何添加搜索用户功能?

ios - WatchKit 添加图像到缓存回调

ios - 如何在 watch 应用程序中缓存图像?

ios - 从iPhone的Watch触发搜寻

ios - 如何在 watch 操作系统中设计像 friend 应用一样的 watch 应用屏幕?

javascript - 滚动顶部动画在 IOS 上不工作

ios - UIImageView 数组不显示内容?

javascript - 弹出窗口在 iPad safari 浏览器中无法正常工作

ios - Watchkit 新 session 不起作用

ios - 我可以在 Swift 中构建 watch 应用程序并将其添加到不是在 Swift 中构建的 iOS 应用程序吗?