第二次调用 openParentApplication 而不是第一次调用 reply
Call openParentApplication the second time without calling reply for the first one
我在 WKInterfaceController
和 iOS 中调用了 openParentApplication
方法,等待来自服务器的响应。然后我想再次使用openParentApplication
取消在iOS中等待响应的操作。
但是第一个调用没有调用 reply
所以第二个调用 openParentApplication
它没有触发 handleWatchKitExtensionRequest
。需要等待第一次调用超时,然后第二次调用将在 handleWatchKitExtensionRequest
.
中触发
有什么方法可以取消对 reply
的第一次调用吗?
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 对象中的值并检查父应用程序中的更改。如果更改,第一个呼叫将被取消。
另一种选择是使用 or MMWormhole 从 WatchKit 向您的父应用程序发送消息。
我在 WKInterfaceController
和 iOS 中调用了 openParentApplication
方法,等待来自服务器的响应。然后我想再次使用openParentApplication
取消在iOS中等待响应的操作。
但是第一个调用没有调用 reply
所以第二个调用 openParentApplication
它没有触发 handleWatchKitExtensionRequest
。需要等待第一次调用超时,然后第二次调用将在 handleWatchKitExtensionRequest
.
有什么方法可以取消对 reply
的第一次调用吗?
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 对象中的值并检查父应用程序中的更改。如果更改,第一个呼叫将被取消。
另一种选择是使用