Skip to main content

Command Palette

Search for a command to run...

iOS: Generating IPA in debug environment

Updated
4 min read

On seeing the title, you might think why do we need to generate an IPA using debug when there is an Adhoc distribution mode already provided by Apple. Warning, Quite a short story ahead on what forced us for a debug IPA build, Please feel free to skip to the Debug IPA Generation part.

One of my friends was working on a personal project using React Native and used to send builds through ad-hoc distribution. For one of the Adhoc testers, the UI isn't showing up its expected behavior and it's happening only on that specific device. The developer of that app tried to replicate the issue using simulators, but he couldn't succeed in it.

If the app crashes due to unexpected behavior, then the crash logger would record the stack trace which would eventually lead to finding the core issue. Unfortunately, the App isn't crashing, therefore some analytics logs are added in order to track it using Analytics Tracker. But still, no information is detected.

Skipping the part - Reaching out to me, Issue explanation and trying to solve the issue together. I'm not much into Cross-Platform development so I couldn't be able to think from React Native perspective. While conversing about it, an insight came to our mind that the warnings would show up while the code runs in the local machine. So, I tried to check in the Xcode and found out warnings are shown only in the debug environment.

We came up with the idea of generating the build-in debug environment using a development provisioning profile with Adhoc tester UDID. Thankfully, it worked and the warning showed up on the Adhoc Tester device & the issue is rectified.

Debug IPA Generation

React Native Bundle

If you are using react-native code, you need to bundle the code to your project folder main.jsbundle by using the below script

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/{AppName}/main.jsbundle

Code Signing

  • Please add the device UDID under the devices menu. Please click on the link, if you want to know more about code signing.
  • If you are opting for automatic signing, Xcode will automatically create/edit the development provisioning profile with the newly added device.
  • If it's a manual signing, Please create/edit the development provisioning profile under the Profiles menu.

Build Generation in Xcode

  • Please select the run device as Generic iOS Device (or) Any iOS Device.

1.png

  • In order to open the Scheme subwindow, Click on the AppName left to the device selection and click on Edit Scheme. You could also perform this by going to Product -> Scheme -> Edit Scheme

1.5.png

  • Select the Run menu on the left and make sure whether the build configuration is set to Debug and then Close it.

2.png

  • Next, Clean the build folder by clicking on the Product -> Clean Build Folder(CMD+SHIFT+K). Once the build folder is cleaned, Please go ahead and build the app, by clicking on Product -> Build(CMD+B). Proceed to the next step, once the build is completed.

3.png

Payload ipa

  • When the build is completed, In the left menu, open the Products folder and then right-click on the App. Select the "Show in Finder" in the shown options.

5.png

  • Copy the following files and folders which is shown in the sub folder of Debug-iphoneos. AppName, {AppName}.swiftModule and copy .dsym if it's available.

6.png

  • In your desired location, Create a new folder named "Payload"(Case Sensitive). Please don't change the folder name to some other as it would result in unexpected behavior. Please paste the copied files from Debug-iphoneos.

7.1.png

  • Go one level up and compress the Payload folder. Once it's compressed, rename the extension from .zip to .ipa

9.1.png

  • You will be prompted with a popup to confirm extension change, click on Use ipa.

10.1.png

  • Your Payload.ipa will be created and would resemble like the below one. Now you can go ahead and share this debug environment IPA to the devices which are mapped to the development provisioning profile.

11.1.png

Note:

  • Only devices(UDID) which are mapped to the development provisioning profile, could install this debug environment IPA.
  • This debug environment IPA provides supports only for the downward version and not for the upward version. In order to use the build-in upward version, please make sure to use the Xcode version corresponding to the iOS version. For Example, Xcode 13 supports iOS 14 and below, but doesn't support iOS 14.1+. In order to use the build-in upward version(iOS 14.1+), it requires a minimum of Xcode 13.1.

    • Xcode 13 -> iOS 14 and below
    • Xcode 13.1 -> iOS 14.1 and below

Well, Hope you got the clarity of debug environment build and the backdrop issue story which lead to it. That's everything for this article. Happy Coding!!!

More from this blog

Rasik Blog

9 posts