expo run:ios --device fails to run on device, but works in simulator

I’m trying to build an run my app on my physical device to test payment workflows, as they will only work on a device – not a simulator.

I can get expo run:ios to work perfectly fine on a simulator, but when trying to run it on my iPhone connected via USB I get this error that’s blocked me for 2 days at this point.

✖ Complete 100%
CommandError: There was an error launching app: The operation couldn’t be completed. 
Unable to launch com.bundle.identifier because it has an invalid code signature, inadequate 
entitlements or its profile has not been explicitly trusted by the user.

I’ve attached a screen shot of the error on my device. It’s frustrating that it complains about not having internet connection, but I’ve tried on WiFi and 4G.

What I’ve tried:

  • App works on simulator
  • App works when building and submitting via TestFlight (but there’s no debug information at this point, which makes development super slow)
  • Turned on developer mode on my iPhone
  • Tried following these expo fyi docs to run it via xcode, but I get the same error
    • Tried manually adding the In App Purchase capability to the xcode before running
  • Tried deleting all provisioning profiles/certificates/identifiers and regenerating them via eas build
  • Downgraded node to 16.13.1 from 19.5 as 19.5 is not supposed by eas
  • Updated eas-cli to latest version
  • Updated to iOS 16.3.1 and it worked? Was previously on iOS 16.0.0

Summary:

  • Followed this, added in app purchase capability manually, and upgraded iOS on my phone and it somehow works…

Gonna post this anyways because I’m still not sure how this ended up working, and the expo command still doesn’t work.

Now when trying to submit to the app store, I’m getting this error:

Invalid Provisioning Profile for Apple App Store distribution. The application was signed with an Ad Hoc/Enterprise Provisioning Profile, which is meant for "Internal Distribution". In order to distribute an app on the store, it must be signed with a Distribution Provisioning Profile. Ensure that you are submitting the correct build, or rebuild the application with a Distribution Provisioning Profile and submit that new build.

I must have changed the distribution profile somewhere on accident which made it work on my connected device but won’t work to submit to TestFlight.

Anyone have any better explanation?