如何将源代码连接到Xcode中的编译框架

时间:2023-01-28 22:59:41

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

我在我的Xcode项目中使用ReactiveCocoa 3.0编译框架。有时候我想看看函数里面放了什么代码。

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

有没有办法连接源代码与已编译的xcode框架,以便能够挖掘Xcode中的代码?

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

更新:我正在使用Carthage依赖管理器和构建工具来构建框架

2 个解决方案

#1


4  

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:

根据我的理解,由于Carthage构建了框架作者提供的现有xcproject,因此有两种方法可以实现您的目标:

  1. configure the framework project to build a debug build with symbols, per @Nikolai's suggestion (which seems invasive, and extra work), or
  2. 根据@ Nikolai的建议(似乎是侵入性的,额外的工作),配置框架项目以构建带符号的调试版本,或者
  3. include the framework project from Carthage/Checkout into your project and use it directly, ala Cocoapods.
  4. 将Carthage / Checkout的框架项目纳入您的项目并直接使用,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.

后一种选择(#2)是我在早期开发时所做的,当我积极地与库进行交互并需要调试时。之后,您可以使用由carthage构建的预编译框架。

#2


2  

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]".

在Xcode中,在框架的构建设置中,查找“在复制期间剥离调试符号”并将其设置为否。此外,您可能希望关闭优化:“优化级别”到“无[-O0]”。

#1


4  

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:

根据我的理解,由于Carthage构建了框架作者提供的现有xcproject,因此有两种方法可以实现您的目标:

  1. configure the framework project to build a debug build with symbols, per @Nikolai's suggestion (which seems invasive, and extra work), or
  2. 根据@ Nikolai的建议(似乎是侵入性的,额外的工作),配置框架项目以构建带符号的调试版本,或者
  3. include the framework project from Carthage/Checkout into your project and use it directly, ala Cocoapods.
  4. 将Carthage / Checkout的框架项目纳入您的项目并直接使用,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.

后一种选择(#2)是我在早期开发时所做的,当我积极地与库进行交互并需要调试时。之后,您可以使用由carthage构建的预编译框架。

#2


2  

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]".

在Xcode中,在框架的构建设置中,查找“在复制期间剥离调试符号”并将其设置为否。此外,您可能希望关闭优化:“优化级别”到“无[-O0]”。