Swift Tricks

My own, mostly internal blog of Swift tips and tricks

Find which library uses a Framework in your iOS app

The problem

Sometimes widely used frameworks are deprecated (an example being UIWebView) and need to be removed from your application. But determining which 3rd party frameworks depend on said deprecated framework can be tricky - so you need to analyze the archive.

Finding what uses a given framework

Searching Xcode and using grep in your project folder can yield some results, but it will not return all of the uses (since it may be used in a binary Framework file).

First create an archive of your app (Product / Archive...). Once this is done, navigate to the folder of the archive and then run the following command to find the framework by name:

# Go to the folder of your application's archive
cd ~/Library/Developer/Xcode/Archives/<date>/myapp.xcarchive/Products/Applications/myapp.app

# Search for the framework by name (UIWebView as an example here)...
nm myapp | grep UIWebView
for framework in Frameworks/*.framework; do
  fname=$(basename $framework .framework)
  echo $fname
  nm $framework/$fname | grep UIWebView
done