Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging (owned) Framework when using Carthage

I am in the process of developing my own Swift framework to be used privately between two of my applications. I am using Carthage to manage that and other dependencies.

I finally got through developing the framework and hooking it up to one of my apps and, not surprisingly, the app crashes in the new framework code.

I would like to debug the framework code. I've looked at some articles that talk about:

  1. Copying the dsym files and
  2. Compiling with debugging information.

Unfortunately, the articles leave out a lot of details (and I'm not a seasoned enough iOS developer or Carthage user to implicitly know them).

Can someone provide a recipe on how to configure the app such that the private framework code is not optimized and I can step into the framework code from the hosting application?

Thanks Peter...

like image 319
psparago Avatar asked Aug 10 '16 00:08

psparago


1 Answers

Here are two options.

1. Debug framework within main project

Follow step 4 of the Carthage guide and then you should be able to step through and debug your private framework.

With the debug information copied into the built products directory, Xcode will be able to symbolicate the stack trace whenever you stop at a breakpoint. This will also enable you to step through third-party code in the debugger.

2. Modify framework within main project

  1. Clone the private framework source locally.
  2. Drag the framework's .xcodeproj into your main project. (Do not have both projects open in Xcode).
  3. remove crthage entry form carthageInput.xcfilelist & carthageOutput.xcfilelist
  4. remove the framework from project -> target -> general -> frameworks libraries and embedded content then add it using the + sign from the dragged project. then you will see beside the framework name Embed & sign

Now you can develop on your private framework and test them all within your main project. Once done

  1. Remove reference to framework .xcodeproj from main project.
  2. Create a new release of your framework.
  3. Update main project to use newer version using standard carthage update
like image 167
ajmccall Avatar answered Oct 15 '22 03:10

ajmccall