JSONException on Photo Capture in Offline Mode (Retool Mobile iOS)

Hi everyone,

I'm building a new app (Business Plan) that needs to work offline, and I've hit a wall with an issue.

The Problem: When I switch the app to Offline Mode on my phone (iPhone 13), taking a picture with the Camera or Image Input component immediately throws a JSONException error.

It looks like this error corrupts the data before it's even saved to the offline storage, because after I go back online, the files fail to synchronize.

Steps to Reproduce:

  1. Run the app on an iOS device.

  2. Switch the app to Offline Mode.

  3. Navigate to the view with the Camera component.

  4. Take a photo.

  5. The JSONException error appears instantly.

What I've Checked:

  • The app works 100% correctly in Online Mode on the same phone.

  • The app works correctly in Edit Mode on my computer.

  • The problem is only happening in Offline Mode.

I've already filed a formal "Report a breakage" with support, but I wanted to ask the community:

Has anyone else run into this? Is there a known workaround or a specific way the Camera component needs to be configured for Offline Mode to avoid this?

Link to video with bug:

The project working on Cloud.

@Darren Sorry to ping you directly, but I saw you're basically a Retool Mobile wizard :man_mage: and help out a ton on the forums.

This is a key functionality for us and it doesn't work.

1 Like

Flattery will get you everywhere - let me take a look! The breakage report you filed previously has already been logged and confirmed as a bug, but I'll poke around to see if there's some configuration option or other tweak that might unblock you. :+1:

After a bit of testing, it looks like the error you're referencing only pops up when you have the Upload file to Retool Storage option checked. Even then, the upload still succeeds after reconnecting to the network. In general, though, I'm a proponent of writing your own upload queries in order to fully control the process from beginning to end.

I've put together an example here (11.8 KB) that utilizes a dedicated upload query and a JS snippet for coordinating multiple uploads.

Give that a shot and let me know if you run into any additional issues!

1 Like

@Darren it is work! Thank you for your solution.

2 Likes