eloadRootControllersWithNames导致错

eloadRootControllersWithNames导致错

本文介绍了WatchKit reloadRootControllersWithNames导致错误,使用pageController或push / pop之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

是否有更好的方法可以干净地重新加载原始文件InterfaceController?

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

编辑,2/19

似乎还有其他一些导致此错误的操作。例如,如果segue到第二个InterfaceController然后popController返回,则经常出现错误。它始终与此函数的辅助调用相关。

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前面提到过,这可以通过执行seguePush,popController,然后尝试reloadRootControllersWithNames来100%重现。

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

如果事先没有完成seguePush / popController,则reloadRootControllersWithNames可以正常工作。

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

这种情况似乎是这个bug的多个>单个多实例的补充。

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

推荐答案

我能够通过在推送的视图控制器上使用popController来解决我的问题实例。相反,我使用reloadRootControllersWithNames代替popController。

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:


  1. 推送视图控制器

  2. reloadRootControllersWithNames返回原始控制器。 (转换不是那么动画,但已足够)

  3. 创建基于页面的视图控制器。

  4. reloadRootControllersWithNames返回原始控制器

  5. 根据需要重复1或3.

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

这样可以消除错误,但代价是非动画popControllers,并允许部分推送和分页。它不会允许更复杂的推送导航。

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.

这篇关于WatchKit reloadRootControllersWithNames导致错误,使用pageController或push / pop之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 21:22