[ExpoKit] Unable to run in debug mode on iPhone

I ran into a strange problem recently in an ExpoKit v27 project.

I started the app in debug mode with XCode on an iPhone 6 device, but the app is being run on production/release mode instead (process.env.NOV_ENV is 'production', and it’s running on JS code from exp publish rather than local code).

I’m able to run it on debug mode on iPhone simulator and Android.

Any idea what could be causing this? Were there any changes made in Expo v27 that could potentially cause this bug?

Hi, that’s odd. No, as far as I know, we didn’t change anything in SDK 27 which would change the way the project runs from a Debug Xcode scheme. You might try searching your ExpoKit dependency for #if DEBUG and breakpointing around there to see which path is getting hit. The DEBUG macro is defined by Xcode when your scheme is Debug.

I have managed to pinpoint the problem and made a reproducible example:

  1. Download https://github.com/riwu/ActivityTracker/tree/detach (note the branch is detach)
  2. yarn install (no need pod install, I included it for reproducibility)
  3. Run the project in XCode

It should be able to run successfully even without exp/yarn start because it’s running in production.

Now clear the content of this file: https://github.com/riwu/ActivityTracker/blob/detach/ios/tamil-hot-house/Supporting/shell-app-manifest.json (generated by exp publish I believe?) and re-run the project. It’ll now fail if you didn’t run yarn/exp start, because it’s now correctly running in debug mode.

1 Like

Hi! I followed the steps you have here, and the app does not run successfully for me after a fresh yarn install. It does however run correctly when I ask Xcode to profile the application – which is switched around from what you’re reporting in your latest comment. Could you explain a bit more about what’s happening?

It seems like the .expo folder content (which was gitignored) must be included to reproduce it. I have cleared the .gitignore and committed the node_modules as well to help with reproducibility. Can you try the updated code again?

What’s basically happening on my machine is that app is running on production even when I select Debug mode on XCode unless i clear the .expo folder or shell-app-manifest.json.

If you still couldn’t reproduce it with the updated code, perhaps it’s some caching problem on my machine? I have already done yarn cache clean, rm -rf node_modules and restarted the OS, is there any other cache that I might need to clean?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.