Can i debug ios application from ipa archive

I have a problem with my application, which only plays when I install it ad hoc but not play if I just run the application from Xcode. I would like to debug this problem, but so far I have been out of luck. I am using Xcode 5.1.1. Here is what I did:

1) Go to Product-> Scheme-> Edit Scheme-> Archive and set the build configuration for debugging.

2) The code signing identifier is installed on iPhone Developer.

3) To generate debug symbols, set to Yes.

4) Go to Product-> Archive and after archiving, click "Distribute", then select "Save for Enterprise or Ad Hoc Deployment".

5) The profile of my development profile is selected.

6) Click "Export" and export the .ipa file.

7) Use the iPhone setup utility to install the application on the device.

8) Run the application on the device.

9) In Xcode, go to Debug-> Attach To Process-> PID or Name, enter the Application Name. Xcode connects successfully and says the launch of the iPad application.

10) However, I cannot hit any breakpoints that need to be removed when I do certain actions in my application (if I install and run the application from Xcode instead, all breakpoints fall).

Am I missing something?

+4
source share
3 answers

Jim Ingham, thanks for your answers.

I found a reason why I was not able to debug static libraries. For each Xcode project, in the Deployment section, there is a Separator Related Product option. In all my projects, this setting was set to Yes.

To debug static libraries for an application created by archiving, I set this parameter to "No" in each project of the dependent library (as well as in the main project). It can also be set differently for Debug / Release modes. After that, I see library symbols created during archiving, and I can debug library code. Hope this helps someone.

Unfortunately (or maybe fortunately) the error that I tried to debug no longer plays when library symbols are not separated. Perhaps something will happen when the characters are deleted, I will need to continue to research.

+5
source

At the moment, you do not have debug information for the application, and since most applications are pretty carefully separated, there will be no characters for lldb. Therefore, we cannot successfully set breakpoints.

When you created the application, Xcode created the dSYM file (MyApp.app.dSYM), which contains debugging information, so everything is not lost. The problem is that you are sticking to some - to Xcode - random application on the device, Xcode is not able to find out where to find its debugging information.

You can add debug information to your debugging session in lldb with the command:

(lldb) add-dsym <PathTo.dSYM> 

You must do this after you attach.

lldb also uses SpotLight to search for dSYM, so if you put dSYM somewhere that SpotLight knows to search (for example, your desktop or folder under your user directory), then lldb should automatically select it.

You can find out if lldb successfully read in dSYM by doing:

 (lldb) image list <AppName> 

If lldb finds dSYM, it will list the path to it on a separate line after listing the path to the binary name AppName.

+7
source

I struggled with the same problem, and just launching my application from Xcode was not an option - I had to build an IPA, load it on an iOS device and then debug it. In the end, I was able to complete this work with the following steps:

1) Set the target of the schema archive for debugging

2) Change the following settings to build Debug

  • Keep personal external characters (KEEP_PRIVATE_EXTERNS): YES
  • Enable Bitcode (ENABLE_BITCODE): NO
  • Band Related Product (STRIP_INSTALLED_PRODUCT): NO

3) Rebuild, archive and deploy the resulting IPA file to your iOS device.

4) Launch the application and in Xcode select Debug / Attach to Process / YourAppName (id)

5) A break in the debugger - you should be able to see the code, set and use breakpoints, etc.

If you want to debug your code from the very beginning, just put a loop that sleeps for a second or two, and then checks the flag at the top of the main function - when you enter the debugger, just change the flag to avoid this loop.

+3
source

All Articles