Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect source code to the compiled framework in Xcode

I'm using ReactiveCocoa 3.0 compiled framework in my Xcode projects. Sometimes I want to see what code lays inside the function.

Is there any way to connect source code with compiled xcode framework to be able to dig inside the code in Xcode?

UPDATE: I'm using Carthage dependency manager and build tool for building frameworks

like image 325
skyylex Avatar asked Jul 09 '15 09:07

skyylex


2 Answers

From my understanding, since Carthage builds the existing xcproject supplied by the framework's author, there are then two ways to achieve what you are looking for:

  1. configure the framework project to build a debug build with symbols, per @Nikolai's suggestion (which seems invasive, and extra work), or
  2. include the framework project from Carthage/Checkout into your project and use it directly, ala Cocoapods.

This latter choice (#2) is what I have done for early development when I am actively interacting with a library and need to debug things. Later, you can use the pre-compiled framework built by carthage.

like image 95
Chris Conover Avatar answered Sep 30 '22 09:09

Chris Conover


If you have the source code and create the framework yourself you should be able to see the source code when debugging. For that, you have to include debugging symbols in the framework build. In release builds symbols are typically stripped, but in a debug build they are preserved and the debugger should be able to show the code.

In Xcode, in the build settings of the framework, look for "Strip Debug Symbols During Copy" and set it to No. Also, you might want to switch optimization off: "Optimization Level" to "None [-O0]".

like image 23
Nikolai Ruhe Avatar answered Sep 30 '22 07:09

Nikolai Ruhe