Removing unused frameworks in Xcode?
Asked Answered
S

2

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?

Stelu answered 21/10, 2011 at 9:37 Comment(3)
not 'answer-worty': I just delete the questionable ones from the link phase and reintroduce them based on ld's errors.Lascivious
@Justin: I disagree, it is answer worthy. It answers the question perfectly well.Arber
@Arber alright, you have convinced me =)Lascivious
L
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.

Lascivious answered 21/10, 2011 at 10:6 Comment(4)
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?Stelu
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.Lascivious
Can you give me an example because I think I haven't come across static libraries.Stelu
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.Lascivious
G
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.

Gouda answered 4/6, 2014 at 1:24 Comment(1)
A screenshot would be really helpful here.Benediction

© 2022 - 2024 — McMap. All rights reserved.