WatchKit reloadRootControllersWithNames导致错误,使用pageController或push / pop之后(WatchKit reloadRootControl

编程入门 行业动态 更新时间:2024-10-26 11:27:35
WatchKit reloadRootControllersWithNames导致错误,使用pageController或push / pop之后(WatchKit reloadRootControllersWithNames causing error, with pageController or after push/pop)

我有一个基本的watchkit应用程序,可以加载3个界面控制器的页面导航。 这很好,但我希望触发一个操作来移除页面控件,并基本上恢复到应用第一次加载时出现的原始InterfaceController。

// 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:@[@{}]];

基于页面的导航删除,原始导航加载一个简短的微调后。 但是,它无法正确运行,原始操作导致此错误。

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

有没有更好的方法来干净地重新加载原始的InterfaceController?

编辑,2/19

看来还有一些其他操作也会导致此错误。 例如,如果继续使用第二个InterfaceController然后popController返回,则通常会出现该错误。 它始终与此功能的次要呼叫有关。

[WKInterfaceController reloadRootControllersWithNames: contexts:]

EDIT2,3 / 18

如前所述,通过执行seguePush(popController),然后尝试reloadRootControllersWithNames,可以在100%的时间内重现这一点。

如果事先没有完成seguePush / popController,那么reloadRootControllersWithNames将正常工作。

这种情况似乎是除了这个bug的multi-single-multi实例以外。

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.

最满意答案

这实际上不是一个错误,因为根据苹果:

您不能组合分层和基于页面的界面样式。 在设计时,您必须选择最适合您应用的内容和风格设计的风格。

很遗憾,我们无法在同一个Watch应用中混用分层导航和基于网页的导航模式。

在为Watch开发应用程序时,我们必须处理许多限制条件之一

I was able to solve my instance of this problem by not using popController on a pushed view controller. Instead I use a reloadRootControllersWithNames in place of the popController.

How this allows both push and paging, via an example:

Push a view controller reloadRootControllersWithNames to return to the original controller. (The transition is not quite as animated, but is sufficient) Create page based view controller. reloadRootControllersWithNames to return to the original controller Repeat 1 or 3 as needed.

This eliminates the error at the cost of non-animated popControllers, and allows partial pushing and paging. It would not allow more complex push navigation though.

There may be a better method of navigating to a sub interface controller without a push call, but I'm not aware of it on the watch yet.

更多推荐

本文发布于:2023-08-07 02:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1458941.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   pageController   WatchKit   reloadRootControllersWithNames   causing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!