I just released a new app and most folks are having no problems with it, but one savvy user contacted me about a consistent crash when selecting an option in a MessageBox. This selection changes to a custom iOSLayout to load new screens in a split view. He’s probably the only person running this app on an M1 iPad, although he’s having no problems with it on his M1 Mac or iPhone. Here’s the crash log he sent me from connecting his iPad to Xcode:
It would seem you have an unhandled exception in the Opening or Activated events, or there is an internal framework error with the XOJViewController which backs MobileScreen/iOSView
I assume that you‘ve not set the sourceView and sourceRect property on the popoverPresentationController on the viewController that you want to present. This is not necessary on the iPhone, but not setting these properties will crash on an iPad. I know that kind of crash
I need to do an update to the app, and will use 2022r3 this time and see if it makes a difference for him.
If Self.ParentSplitView <> Nil Then 'iPad
Var bdl As New ChargenLayout
App.CurrentLayout.Content = bdl.Content
Else 'iPhone
Var cbd As New BasicDataScreen
App.CurrentLayout.Content = cbd
End If
Chargen Layout is just a split iOSLayout. This works for everyone except this guy with an M1 processor in his iPad Pro.
// Create a new citizen
Var c As New CitizenClass
Citizens.Add(c)
CurrentCitizen = Citizens.LastIndex
// Add Stop Button
Var stopbutton As New MobileToolbarButton(MobileToolbarButton.Types.Stop)
RightNavigationToolbar.AddButton(stopbutton)
The master screen Activated event is
// Get current name for citizen
NameTextField.Text = Citizens(CurrentCitizen).Name
If Citizens(CurrentCitizen).Male = True Then
SexSegmentedButton.SelectedSegmentIndex = 0
Else
SexSegmentedButton.SelectedSegmentIndex = 1
End If
The detail screen Activated event references Citizens(CurrentCitizen) to fill out numerous labels on that screen.
CurrentCitizen should be valid at this point, I presume?
I believe you have tested your app on an iPad Simulator and perhaps a real iPad if you have one.
You definitely have an OutofBounds exception in the Activated event of one of your views.
I see that CurrentCitizen is changed in your Masterview.Opening event, it might be possible that the DetailView.Activated event is happening before the MasterView’s Opening event.
Make sure you check for OutofBounds in both Activated events and eventually move code to a method and use Timer.CallLater 200, AddressOf TheMethod to make sure the execution is delayed a little.
Thanks for all the help. I’ve asked the user to check if a build done with 2022r3 instead of r2 makes a difference. If not, your suggestion is a good one. It’s interesting that this problem happens very rarely.
I’ve confirmed with the user that the detail screen activates before the master screen even opens! So I’ll be adding a delay timer to open the detail screen. Interesting that this only occurs on an M1 iPad Pro.