iosxcodeapple-developer

How to test app on real iOS device in airplane mode


I am trying to test my app on a real iOS device in airplane mode.

I have noticed edge cases when running the app in airplane mode after being installed from Testflight but I am not able to reproduce them with Xcode.

When starting the app from Xcode I get the error on the device

Unable to Verify App

An Internet connection is required to verify trust of the developer "Apple Development: First Last (AB12C34D)". This app will not be available until verified.

while Xcode is complaining

The operation couldn’t be completed. Unable to launch golf.movesmart.app1 because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.

I found this post

https://developer.apple.com/forums/thread/697226?answerId=699899022#699899022

but generating a new certificate and even a new profile did not help.

I confess that I am missing a clear understanding of Apple's certificate and profile management.

What should I do to test my app in airplane mode while debugging in Xcode?


Solution

  • I realised that I had to initially start the app with network connection. So I performed these steps:

    1. Remove the app completely from the device
    2. Quit and restart Xcode
    3. Leave the device connected to the Internet
    4. Run the app from Xcode
    5. Stop the app
    6. Switch on airplane mode on the device
    7. Start the app from Xcode

    The precondition to the above steps is to install a profile specifically created for offline mode. Go to your developer account an create a new profile:

    enter image description here

    Once done:

    1. in the Signing & Capabilities tab of your target
    2. untick Automatically manage signing
    3. import this profile in the Provisioning Profile drop-down list.