ios - WatchKit reloadRootControllersWithNames 导致错误,使用 pageController 或在 push/pop 之后

标签 ios watchkit

我有一个基本的 watchkit 应用程序,可以加载 3 个界面 Controller 的基于页面的导航。这很好用,但我想触发一个操作来删除页面控件,并基本上恢复到应用程序首次加载时存在的原始 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,然后尝试重新加载 RootControllersWithNames,这在 100% 的时间内是可重现的。

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

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

最佳答案

这实际上不是错误,因为根据 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.

很遗憾,我们不能在同一个 Watch 应用中混合使用分层和基于页面的导航模式。

这只是我们在为  Watch 开发应用时必须处理的众多限制之一

关于ios - WatchKit reloadRootControllersWithNames 导致错误,使用 pageController 或在 push/pop 之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28596405/

相关文章:

ios - WatchKit 无效的捆绑结构 - WatchKitStub

ios - 使用 watchOS 2 从 Apple Watch 向 iPhone 应用程序发送消息

ios - 我可以在 Collection View 中的后续单元格之间添加延迟并为每个单元格设置动画吗

ios - SKStoreReviewController requestReview 对话框中缺少文本

ios - 如何更新 mapView 上 MKAnnotation 对象的位置?

iOS Swift - 当 1 个按钮覆盖另一个按钮时,为什么单击 1 个按钮会激活另一个按钮

swift - 当用户转弯时是否有任何事件发生?

ios - 如何在 iPhone 应用程序和 Apple Watch 之间共享数据?

ios - 使用 Swift 3 和 Realm 同步 Apple Watch 和 iPhone

ios - 当应用程序收到指向自身的重定向时,URL 不受支持