- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 WKInterfaceController
和 iOS 中调用 openParentApplication
方法等待来自服务器的响应。然后我想再次使用openParentApplication
在iOS中取消等待响应的操作。
但是第一次调用没有调用 reply
,所以我第二次调用 openParentApplication
它没有触发 handleWatchKitExtensionRequest
。需要等待第一次调用超时,然后第二次调用将在 handleWatchKitExtensionRequest
中触发。
有没有什么方法可以取消第一次调用而不等待回复
?
最佳答案
documentation确认您的问题:
If you call this method multiple times in quick succession, your calls are serialized so that each subsequent call is delayed until the response from the previous call is received.
要取消您的第一个调用,您可以更改共享 NSUserDefaults 对象中的值并检查父应用程序中的更改。如果更改,第一个调用将被取消。
另一种选择是使用 Darwin notifications或 MMWormhole将消息从 WatchKit 发送到您的父应用程序。
关于ios - 第二次调用 openParentApplication 而不是第一次调用 reply,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30453560/
在我的 watch 应用程序中,我使用 openParentApplication 与父应用程序通信,但这并不总是可靠的,尤其是当我有一段时间没有使用父应用程序时。看来这不是唤醒父应用进行通信。但是,
我正在尝试使用 openParentApplication 从服务器请求数据并在 watch 扩展中使用它,但是当主应用程序未在前台运行时我没有得到任何回复。当主应用程序在前台运行时,一切正常。 最佳
我的 watch 应用程序使用 openParentApplication 从其 WatchKit 扩展请求数据。它从 watch 应用程序的主页 init() 开始: class HomePage
我目前有一个问题。我想要的行为:如果我打开我的 WatchKit 应用程序,我会调用“openParentApplication”。我收到了我想要的数据。但是如果我在真实设备上测试,它就不起作用,因为
在我的应用程序中,我从 iPhone 到 Apple Watch 以及从 Apple Watch 到 iPhone 进行通信。 对于 Apple Watch 上的 Tableview,当应用程序在 i
我在 WKInterfaceController 和 iOS 中调用 openParentApplication 方法等待来自服务器的响应。然后我想再次使用openParentApplication在
打开 Apple Watch 应用程序后,我用 openParentApplication:reply: 唤醒 iPhone 应用程序以获取当前位置。正如苹果所说 here ,您应该避免在 Watch
我正在尝试通过 Watchkit 操作打开 Swift iOS 应用程序,但我无法找到 openParentApplication 方法 // Register notifications in i
我正在实现 Apple Watch。在我的 Watchkit 扩展中,我使用该方法与“主应用程序”通信。 [WKInterfaceController openParentApplicatio
我正在开发一个 Apple Watch 应用程序,它使用 openParentApplication:reply: 方法与其父应用程序通信。 父应用程序与 Web 服务通信,并通过使用包含数据的 NS
我有一个 watch 应用程序需要与父应用程序通信以获取一些信息。这应该只在口袋里使用 watch 和手机时发生。它曾经像这样工作: 在 watch 上的 InterfaceController 中:
我正在尝试实现 Apple Watch 扩展。我需要调用我的 iPhone 应用程序类方法来触发 Web 请求。我在苹果文档中看到了这个方法,我也在尝试同样的方法。但是这个方法没有调用 - (void
在更新到 Xcode 7 之后,我刚刚将我的项目更新到 Swift 2.0,但我的 watch 扩展遇到了问题。 我想要 watchOS 1 目标和 watchOS 2 目标,所以我为 watchOS
我正在尝试将信息从我的 WatchKit 应用程序发送到我的主要父应用程序,据我所知,我应该只能使用 openParentApplication在我的 watchkit 扩展中,handleWatch
情况:我在 Watch 应用程序中使用 openParentApplication 来调用主应用程序中的 handleWatchKitExtensionRequest。这在模拟器中运行良好,并且在 i
当我激活我的 WatchApp InterfaceController 时。它所做的第一件事是尝试通过调用“OpenParentApplication”方法来唤醒 parentApplication(
我正在开发一个在 watch 和 iOS 父应用程序之间进行通信的应用程序。它通过打开 WatchKit 扩展将数据发送到父应用程序。我知道 openParentApplication:reply 在
我正在使用 openParentApplication:和 handleWatchKitExtensionRequest:请求并发送一个 NSNumber 对象,该对象包含来自核心位置 locatio
我为 Apple Watch 创建了一个较小的项目,以与其运行的父应用程序进行通信。 所以我在我现有的 iOS 项目中创建了一个 Watch 套件扩展,但是当它从 Watch 端调用 openpare
更新到 Xcode 7 beta 后,在运行代码行“WKInterfaceController.openParentApplication”时,我收到以下错误消息:“‘openParentApplic
我是一名优秀的程序员,十分优秀!