I have two projects, one is the networkLib
for login and some other network function, the other is the usingLibDemo
. So I have all the source code
Use XCode Workspace when you deal with multiple framework projects. When you use a workspace, breakpoints will work and you can find your crash without loads of back and forth debugging. It will be much easier to manage your frameworks in the long run.
The following works considering the scenario that you have the framework project separately and added a.framework to some project B.
You'll now see program stopping at the breakpoints set in the framework as well.
You should debug the project networkLib which outputs the framework separately. The framework do not have app like structure so a framework file within other project can't be debugged.
You can also add the entire library (networkLib
) project into your project and link the library dynamically by adding dependency in project settings. So you can have all the source code within your project. So you can debug it in run time.
If someone would have the same question in future (now I am using Xcode 8):
You can:
Don't forget set some breakpoints in your framework project.
When the library is built with all symbols, it contains full paths to the each source file embedded in itself. You can actually see this if you open the .a with a hex viewer. With this in place, the XCode will know how to get to the source file.
Setting breakpoints is somewhat more challenging. You basically have to make XCode slowly discover source files from your library by stepping into methods in those file. Once XCode has opened the file, you can set the breakpoint anywhere in it.
It is a bit painful but it works and you do not have to make the library project a subproject if you do not want to.