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

269 Views Asked by At

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.

1

There are 1 best solutions below

0
On

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