Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WatchKit reloadRootControllersWithNames causing error, with pageController or after push/pop

Tags:

ios

watchkit

I have a basic watchkit app that loads a page based navigation of 3 interface controllers. This works well, but I'd then like to trigger an action to remove the page-control and essentially revert back to the original InterfaceController that was present when the app first loads.

// load page based control, with 3 views.  this works ok
[WKInterfaceController reloadRootControllersWithNames:@[@"pageController1",@"pageController2",@"pageController3"] 
                       contexts:@[@"data1",@"data2",@"data3"]];

// attempt to reload original interface controller, identified by storyboard id
[WKInterfaceController reloadRootControllersWithNames:@[@"myInterfaceController"] contexts:@[@{}]];

The page based navigation remove, the original navigation loads after a short spinner. However it fails to function correctly and original Actions result in this error.

Extension[6766:123665] *********** ERROR 
-[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:(null) not found

Is there a better way to cleanly reload the original InterfaceController?

EDIT, 2/19

It seems there are some other actions that are causing this error too. For instance, if segue to a second InterfaceController and then popController to get back, the error often appears. It is always related to a secondary call to this function.

[WKInterfaceController reloadRootControllersWithNames: contexts:]

EDIT2, 3/18

As previously mentioned, this is reproducible 100% of the time by doing the seguePush, the popController, then attempting to reloadRootControllersWithNames.

If the seguePush/popController is not done beforehand, then the reloadRootControllersWithNames will work fine.

This situation seems to be in addition to the multi->single-multi instance of this bug.

like image 909
Miro Avatar asked Feb 19 '15 00:02

Miro


2 Answers

This is actually not a bug because according to Apple:

You cannot combine hierarchical and page-based interface styles. At design time, you must choose the style that best suits your app’s content and design for that style.

So unfortunately, we can't mix Hierarchical and Page-based navigation patterns within the same Watch app.

Just one of many limitations we have to deal with when developing apps for  Watch

like image 189
topes Avatar answered Nov 03 '22 19:11

topes


This is a bug in WatchKit in Xcode 6.2 Beta 5. Please dupe the following radar on Apple's Bug Reporting System to help raise the priority to get this fixed.

In the meantime, a workaround that I've found can be found on the dev forums. What you can do is add a dummy interface controller to any single interface controller page set so you always have two. This will fix the error until Apple get's the bug fixed (hopefully in Beta 6). Please dupe!

like image 39
cnoon Avatar answered Nov 03 '22 18:11

cnoon