Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing unused frameworks in Xcode?

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?

like image 708
Peter Warbo Avatar asked Oct 21 '11 09:10

Peter Warbo


People also ask

How do I find unused files in Xcode?

xcutility is a tool to find and delete unused files from Xcode projects. It recursively searches through a path to find all of the path's Xcode projects and files, and will tell you which files are not referenced or built in any of your Xcode projects.

Where is linked frameworks and libraries in Xcode?

If you're building for iOS, tvOS, or watchOS: On your application targets' “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

Where are frameworks Xcode?

Xcode passes this list of directories to the compiler and linker, which both use the list to search for the framework resources. Note: The standard locations for frameworks are the /System/Library/Frameworks directory and the /Library/Frameworks directory on the local system.


2 Answers

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.

like image 99
justin Avatar answered Oct 14 '22 18:10

justin


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.

like image 36
Its_Cory Avatar answered Oct 14 '22 19:10

Its_Cory