How to find out which libraries are being referenced by your binary

So your app has been uploaded to Test Flight. QA and the testing team decide that it is (finally) fit for production. Then, add a new build, write up the ‘What’s New’ section, choose your best screenshots and hit Submit For Review. Job done, now time to sit back and wait for the 5 star reviews to come in.

The app status changes from ‘Waiting for Review’ to ‘In Review’. Any time now it’ll be available to everyone with an iPhone.

Then App Store Connect flashes a notification, and there’s an email with a link to the Resolution Center. The binary has been rejected. Here’s why:

Guideline 2.5.1 – Performance – Software Requirements

Your app still uses or references the following non-public APIs:

– LinkPresentation.framework
– QuickLookThumbnailing.framework

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change. 

Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.

Where on earth did this come from? I have no idea. That last sentence is rather intimidating. What even are these frameworks?

Link Presentation seems to be for rich links. Scratching my head to think of any of them in the app. A quick Search in Files shows up no matches. Almost certainly, I’m not using this library. With a degree of certainty, I can say that about the QuickLookThumbnailing framework too.

I stuck all this in to Google, of course, and there is a good answer here. This basically explains that setting the linker behavior to ‘Link Framework SDKs Only’ is how to fix this. In Visual Studio For Mac, you can do this by right clicking on your iOS project -> iOS Build. Check that your configuration is set to Release, and that Linker Behavior is set correctly. By default, it sets to Link Framework SDKs Only for release and Don’t Link for Debug.

Uhmm, it already says that….

I gather that you probably wouldn’t still be reading if this was all as it was. In fact, you wouldn’t be reading at all as you wouldn’t have had the error. But if this still hasn’t fixed the issue, how do I go about checking if these libraries are in the binaries that I have submitted?

First, find where your app binary is output to when you build. In Visual Studio for Mac, you can get this by ctrl-clicking on your project -> Options -> Output. Change Configuration to Debug (for now – we want to test the linker settings with ‘Don’t Link’.) Hit Browse and the Finder should open, taking you to the Debug folder.

In there, you should find your app name. It will match what you have for Assembly Name in the Output project options that you looked at in the previous step. There should be no file extension name. If you have Terminal in your Dock, drag the file into it, otherwise open a Terminal and navigate there manually.

Run the command otool -L {yourappname}

This should show you the libraries that are being referenced. As we had chosen ‘Don’t Link’ in our linker settings, there should be, well, a lot.

Now that you know how to do this, try it on a release build. Increment your Build in Info.plist and set your app to Release mode. Select Build -> Archive for Publishing. Once the app is archived, ctrl-click on it. From there, select Reveal in Finder. Ctrl-click on this and choose ‘Show Package Contents’. If it hasn’t opened automatically, select Products -> Applications and then drag your app in to the Terminal. Run the otool command as above.

If this is still showing the libraries that you don’t want, then you’ve got a problem. The possible fixes are:

  • Go to your Project Options (ctrl-click your project -> Options) -> iOS Build and choose Release configuration. Linker Behavior should be set to Link Framework SDKs Only.
  • If that is the case, then check your Configurations. Ctrl-click your solution -> Configurations -> Configuration Mappings. Select Release as the configuration and check that your iOS project has the Configuration that you expect. In my case, somehow the Release configuration got set to the Debug configuration for the iOS project. The Debug Linker Settings were, you guessed it, set to Don’t Link. So that meant my Release build was, too. Not great…

Leave a Reply

Your email address will not be published. Required fields are marked *