简体   繁体   中英

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.

  1. Randomly after a while (30-1 min).

  2. You will find that one of the interface controllers gets missing.

  3. Blank view is shown, UI disappears completely. ( 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.

To reproduce

  • Create a new application.

  • Create a new Watch application

  • Added 2 additional interface controllers to the storyboards

  • Add Identifier for both

  • Inside the initial interface controller call

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 )
  • 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.

I had the same issue and it was due to calling crownSequencer.focus() without a corresponding crownSequencer.resignFocus() call. In my case I was calling focus() in didAppear() and once I added a resignFocus() call to willDisappear() the problem went away.

Similar question here: Black screen page on apple watch apps with more that one page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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