Remote Build / Emergency Build Prep
These instructions are for installing Loop to your own phone without being connected to a computer. Never build Loop for another person other than your own family members. This method requires the use of a Mac and is not the same as the Browser Build using GitHub and Test Flight.
IMPORTANT: In order to build using Diawi, you must
- Have previously built Loop to that iPhone, or
- Manually add the iPhone’s UUID to your Apple Developer Account before building the Loop app in Xcode.
![Emergency-Build-Steps2](http://35.92.135.207/wp-content/uploads/2023/07/Emergency-Build-Steps2.png)
![Remote-Build-Steps](http://35.92.135.207/wp-content/uploads/2023/07/Remote-Build-Steps.png)
-
- To remotely build Loop to your phone, you have to use Xcode to create an IPA file and upload it to Diawi.com to create a link to click on the phone you want to build Loop to.
- Since the link from Diawi will only work for 24 hours, store your IPA file in the cloud (iCloud, Dropbox, Google Drive, etc) so you can download it and upload it to Diawi from your phone whenever you need to emergency remote build.
- The provisioning profile in the IPA is also only good for up to one year from its creation date, so be sure to keep it updated in your cloud storage. Also, upload a new IPA whenever you update your version of Loop. If the Loop version on your phone is newer than the Loop version of your IPA and you need to do an emergency remote rebuild, you should delete Loop from your phone first which would mean reentering all of your settings and losing your current pod.
- If you use remote overrides/boluses/carbs, be sure to add the LOOP_PUSH_SERVER_ENVIRONMENT variable to Nightscout and set it to production as explained on the remote overrides page in LoopDocs whenever you are using Loop that was built remotely. If you later build Loop directly from Xcode, remove this variable from Nightscout.
Build the IPA File
- If you’ve recently successfully build Loop, just open your Loop project in Xcode. If you haven’t, follow all the steps for a new build or a rebuild and build to either a phone or a simulator first to make sure everything is working the way it should.
- Select Any iOS Device (arm64) as your project’s device target.
- In the Product menu, select Clean Build Folder.
- In the Product menu, select Archive. When the archiving process completes, an Archives window will pop up. If you close the Archives window and want to open it again later, at the top of the screen click Xcode > Window > Organizer.
- Select the app you just created (check its Creation Date) and click Distribute App.
- Select Ad Hoc for the distribution method and click Next.
- Set App Thinning to None, uncheck all Additional Options, and click Next.
- Select Automatically manage signing and click Next. This will start generating the IPA file.
- When the file generation process completes, click Export and choose where to save the IPA file. You can save it in local storage and then upload it to Diawi and/or a cloud storage service, or you could save it directly to a cloud storage service if your Mac is set up for that.
Upload to Diawi and Install
- Make sure your IPA file is accessible on the device you’re uploading to Diawi from. It does not need to be uploaded from the phone you’re building Loop to, but it can be.
- Go to diawi.com
- Click Add file(s) and select your IPA file.
- If there’s a cloud icon in the upper right of the file icon, press and hold it and tap Download first.
- Sometimes even after it’s downloaded to your iPhone you have to press and hold the icon first and then tap the icon once a menu appears.
- If you run into an error where Diawi tells you it’s an invalid file type even though it’s a valid .ipa file, try uploading from a different browser, updating your iOS to the newest version, or uploading it from a different phone, computer, or tablet.
- Uncheck both Allow… boxes.
- Click More Options and enter a password.
- Enter your e-mail address and once the IPA has finished uploading, click Send.
- Open the e-mail from Diawi on the device you are building Loop to open click the link within the email in Safari. Do not use a different browser for this step as it only works with Safari. If you don’t see this email in your inbox, check your junk folder.
- When the link loads, enter your password and click Submit. On the next page, click Install Application. On the popup, click Install.
- Swipe to the home screen to get visual confirmation it is installing (the pie animation overlay graphic on the icon).
- After Loop finishes installing, check its expiration date. In Loop, tap the settings gear icon and tap Issue Report. Look for profileExpiration near the top. This is the date Loop must be rebuilt by before it will stop working. It is also the expiration date of the IPA file.