1

I call openParentApplication method in WKInterfaceController and in iOS waiting response from server. Then I want to cancel the operation for waiting response in iOS using openParentApplication again.

But the first call didn't call reply so the second I call openParentApplication it not fire the handleWatchKitExtensionRequest. Need to wait the timeout from the first call and then the second call will fired in handleWatchKitExtensionRequest.

Is there any method to cancel the first call to without wait the reply?

Akirayjin
  • 657
  • 1
  • 7
  • 11

1 Answers1

1

The documentation confirms your problem:

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.

To cancel your first call, you could change a value in a shared NSUserDefaults object and check for the change in the parent applications. If changed, the first call is cancelled.

Another option is to use Darwin notifications or MMWormhole to send a message from WatchKit to your parent application.

Community
  • 1
  • 1
John
  • 8,468
  • 5
  • 36
  • 61
  • How to use NSUserDefault between watchkit and parent app? I can't use Group App as I have issue with Provisioning. – Akirayjin May 26 '15 at 09:22
  • As I said before, I can use App Groups because I don't have provisioning in Developer Team to my project and MMWormhole is using App Groups. Is there any alternative way without using App Groups? – Akirayjin May 26 '15 at 09:47
  • 1
    You may use Darwin notifications – John May 26 '15 at 10:05
  • So is there any guide or tutorial about using Darwin Notification step by step? What to code in parent App and what to code in watchkit. – Akirayjin May 26 '15 at 10:23
  • 1
    Yes, I've added a link to my answer above. – John May 26 '15 at 14:26
  • Trying to following the guide you gave to me. I don't know how to write it in swift. – Akirayjin May 27 '15 at 06:26