14

Over time when you develop an application you add new libraries to it, new frameworks needed for the libraries to work. Then you remove libraries and if you are like me you have forgotten to remove the frameworks that you initially added.

Is there a way to find out what frameworks are needed for my code to function?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193

2 Answers2

8

I hate to grave dig, but I had found that you can easily test dependency by unchecking it from your target in Inspector and building. If there are no errors, there is no dependency.

Its_Cory
  • 81
  • 1
  • 1
8

I just delete the questionable frameworks from the link phase in Xcode (or the xcconfig, if you define them there) and reintroduce the frameworks based on ld's errors.

If you are targeting multiple OS versions, it may be a good idea to also build and link against those SDKs since things can move around a bit.

I also do not typically link static libraries to their dependencies, reserving that for the final executable.

Once that phase is complete, you can remove the frameworks you do not link from your Xcode project.

justin
  • 104,054
  • 14
  • 179
  • 226
  • What do you mean with "link static libraries to their dependencies, reserving that for the final executable." Also is there some documentation what the different frameworks are supposed to support in Objective-C? – Peter Warbo Oct 21 '11 at 11:18
  • a) It means that my targets which are static libraries do not link to external libraries by default. I save that for the final link. b) I'm not sure what you asking. – justin Oct 21 '11 at 17:55
  • Can you give me an example because I think I haven't come across static libraries. – Peter Warbo Oct 21 '11 at 21:47
  • static libraries are a target type for executable code, similar to a dynamic library or framework (like a dynamic library with resources), but different in that their symbols are merged with the final executable rather than loaded dynamically. it's apparently not the issue in your build; if you had developed static libraries that your app linked to, chances are very good that you would know that you were linking to them. – justin Oct 21 '11 at 22:06