Imagepicker crash when used in MobileToolbar

If I add an ImagePicker to a mobile screen that has toolbar buttons, and .SHOW it from the ToolbarButtonPressed event, as soon as an image is selected, the app crashes uncatchably.

If I call .show from a normal Button pressed event on the same screen, it works.

What am I missing?

The code for comparison

Can you show the first few lines of the crash?

This works fine in my other ios app, same Xojo version (2025R1)

Right. When you get that notification, click it. It should show you a detailed crash report.

Perhaps not an ideal answer but in the past I have worked around a couple of these event hierarchy type crashes in iOS projects by using Timer.CallLater(0, WeakAddressOf MethodToDoTheThingLater) so that the current event handler (ToolbarButtonPressed in this case) completes before the next piece of UI is triggered.

Sadly, nothing happens. I can move the message about, but no extended report appears no matter what I click upon.

Got it.

This new app didn’t have the ‘capabilities request’ to access Photos, while the ‘other’ app did.

Things you set up once and forget about later
 :slight_smile:

Still a pretty unhelpful crash, however.

Ah yes. Apple states in their docs that if you haven’t defined the “why this app needs access to your photos” string, your app will crash. This is true for all of the items which have that type of string required.

I presume the crash log, had Jeff been able to get it, would have told us that?

I think there might be a bug related to the crash log alert, because Greg mentioned being able to get the crash log from there but Jeff said that didn’t work.

True. No sign of one, no matter what I tried.

Or he just doesn’t have it set up to provide them. There’s a tool in the Xcode developer tools that lets you set your preference. Something like

  • don’t tell me about it
  • notify me
  • Notify me and let me file a report

That last one is what you want and then you just don’t file the report.

1 Like