stratigrafia

INSTALLING AN IOS ARCHIVE FROM XCODE 9

10/12/2017

Sometimes, you need to install an older version of an iOS app you’ve developed so that you can test that migration is handled properly when a user updates your app. Apple makes this an easy two-step process in Xcode 9.

This situation arose recently for me on a couple of Swift apps I was updating. I had made changes to Core Data, and losing a user’s field data is a nightmare I’d like to avoid. The only way I could be sure that the migration would work would be to run the last version I shipped, then run the new version and verify the data was intact.

My first thought was to launch the git branch for that old version, recompile it and install. Unfortunately, given the frequent changes to Swift and my CocoaPods dependencies, these were not simple recompiles.

I then realized that it must be possible to install on old archive onto a development device. It is, and it is easy.

Step 1: Build the .ipa file

• Open Xcode, then go to the menu Window… Organizer.

• Select the app name in the left column, then select the archive in the main (center) part of the window.

• In the right column, click the Export… button.

• In the window that opens, choose Development. Verify the build recommendations in the next window (I accepted the defaults), and click Next. In the following window, verify that automatically manage signing is checked, and click Next. Xcode will compile the app and show a summary. When it finishes, click the Export button, select a location, then click the Export button again.

You now have an .ipa file that you can install.

Step 2: Install the .ipa file

• In Xcode, go to the menu Window… Devices and Simulators.

• Select the device in the left column.

• In the center part of the window, click the plus button at the bottom left of the list of Installed Apps.

• Navigate to the folder of the archive you just exported. Inside it, you should see .ipa file; click on it, then click the Open button in the bottom right, and Xcode will install the .ipa file.

The old version of your app is now installed on your device.

 

Home