简体   繁体   English

如何修复Apple Watch中页面Controller内缺少的接口controller?

[英]How to fix missing interface controller inside Page Controller in Apple Watch?

What I found is?我发现的是什么?

Try to scroll horizontally between the interface controllers inside a root page controller.尝试在根页面 controller 内的界面控制器之间水平滚动。

  1. Randomly after a while (30-1 min).一段时间后随机(30-1分钟)。

  2. You will find that one of the interface controllers gets missing.您会发现其中一个接口控制器丢失了。

  3. Blank view is shown, UI disappears completely.显示空白视图,UI 完全消失。 ( Black view with no interface ). (没有界面的黑色视图)。

  4. Try to open the view debugger in XCode, you will find that the Interface window of the view is missing from the page view controller hierarchy.尝试打开XCode中的视图调试器,你会发现页面视图controller层次结构中缺少视图的接口window。

To reproduce重现

  • Create a new application.创建一个新的应用程序。

  • Create a new Watch application创建一个新的 Watch 应用程序

  • Added 2 additional interface controllers to the storyboards在情节提要中添加了 2 个额外的界面控制器

  • Add Identifier for both为两者添加标识符

  • Inside the initial interface controller call里面的初始接口 controller 调用

WKInterfaceController.reloadRootPageControllers(withNames: ["View1","View2"], contexts: ["View1","View2"], orientation: .horizontal, pageIndex: 1)

  • Run the application on Watch OS 6 Series 3 ( Simulator or A device )在 Watch OS 6 Series 3(模拟器或 A 设备)上运行应用程序
  • Try to scroll randomly尝试随机滚动

What I expect from the Page controller to hold the interface controllers as it should and it shouldn't show a blank black screen, while the user is scrolling.我对页面 controller 的期望是保持界面控制器应有的状态,并且在用户滚动时不应显示空白的黑屏。

I had the same issue and it was due to calling crownSequencer.focus() without a corresponding crownSequencer.resignFocus() call.我遇到了同样的问题,这是由于在没有相应的crownSequencer.resignFocus()调用的情况下调用了crownSequencer.focus() ()。 In my case I was calling focus() in didAppear() and once I added a resignFocus() call to willDisappear() the problem went away.在我的情况下,我在didAppear()中调用focus() ) 并且一旦我添加了resignFocus()调用willDisappear()问题就消失了。

Similar question here: Black screen page on apple watch apps with more that one page这里有类似的问题: Apple Watch 应用程序上的黑屏页面超过一页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM