Deepak Sharma
Deepak Sharma

Reputation: 23

[WKInterfaceController pushControllerWithName:context:]: called from queue other than main. This is not supported and may fail in the future(iOS)

Error - [WKInterfaceController pushControllerWithName:context:]: called from queue other than main. This is not supported and may fail in the future.

In my iOS with apple watch, this error is coming when I am trying to push WKInterfaceController.

What I tried -

  1. DispatchQueue.main.thread

  2. Delay Timer

    DispatchQueue.main.async { if message["xyz screen"] == "new screen" { popToRootController() self.pushController(withName: "new", context: self) return } }

Upvotes: 0

Views: 116

Answers (1)

Eric
Eric

Reputation: 151

If you have in your code:

pushController(withName: "Name", context: context)

Just add in the main thread with self inside:

DispatchQueue.main.async {
    self.pushController(withName: "Name", context: self.context)
}

Upvotes: -1

Related Questions