Missing Library Error in Mac Catalyst when distributed through Testflight

The iOS version of the app is functioning correctly on TestFlight, and there are no issues when building the Mac Catalyst version of the app from Xcode. However, when distributing the app to TestFlight for Mac Catalyst, the FFmpegkit library fails to load, resulting in a crash. The crash report indicates that the library is missing and cannot be located in the designated file path.

Specifically, the crash report states that the library could not be loaded from "@rpath/ffmpegkit.framework/ffmpegkit". Despite extensive efforts, I have been unable to resolve this issue.

This is error message in the crash report.

Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: @rpath/ffmpegkit.framework/ffmpegkit Referenced from: <9162F8B0-7112-310B-8EDA-59766087927F> /Applications/MyApp.app/Contents/MacOS/MyApp Reason: tried: '/System/Library/Frameworks/ffmpegkit.framework/ffmpegkit' (no such file, not in dyld cache), (security policy does not allow @ path expansion) (terminated at launch; ignore backtrace)

Are there any alternative solutions to resolve this problem?

This is all the things I have already tried:

I tried most of the solutions mentioned in the post below. https://stackoverflow.com/questions/24333981/ios-app-with-framework-crashed-on-device-dyld-library-not-loaded-xcode-6-beta

  • I checked the package content found in Testflight and the paths are correctly matching the following /System/Library/Frameworks/ffmpegkit.framework/ffmpegkit

  • I ran the app scheme as release within Xcode and it build and ran fine with no issues

  • I manually loaded the signing certificates for mac catalyst and still getting the error

  • Deleted all derived data

  • Deleted and reinstalled Xcode and also tried previous Xcode versions.

  • Deleted the project completely

What is your rpath set to? If you do this:

% otool -l &#x2F;Applications&#x2F;MyApp.app&#x2F;Contents&#x2F;MacOS&#x2F;MyApp | grep -B 1 -A 2 LC_RPATH

what do you see?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I get the following rpath when entering the command above

Load command 72 cmd LC_RPATH cmdsize 40 path @loader_path/../Frameworks (offset 12)

Load command 73 cmd LC_RPATH cmdsize 40 path @executable_path/Frameworks (offset 12)

Load command 72 cmd LC_RPATH cmdsize 40 path @loader_path/../Frameworks (offset 12)

Load command 73 cmd LC_RPATH cmdsize 40 path @executable_path/Frameworks (offset 12)

Thanks for your help Quinn

For those following along at home, I’ll be helping sterrier in a different context.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I also am getting this same issue loading the Lottie.framework at runtime from my Mac Catalyst app

dyld[19098]: Library not loaded: @rpath/Lottie.framework/Versions/A/Lottie
  Referenced from: <47989D2F-6B41-3EE2-89CA-48B1D3D8F089> /Applications/Play 2 - Beta.app/Contents/MacOS/Play 2 - Beta
  Reason: , (security policy does not allow @ path expansion)
[1]    19098 abort      /Applications/Play\ 2\ -\ Beta.app/Contents/MacOS/Play\ 2\ -\ Beta

A few notes: :

  1. Hardened Runtime Enabled w/ Disable Library Validation
  2. Sandbox Enabled
  3. Archiving with Xcode Cloud using manual signing
  4. I then distribute with a post build action to create a DMG with the exported archive provided by XC Cloud, and notarize the DMG
  5. All code sign verification looks good
  6. The Lottie.framework does exist in the <.app>/Resources/Frameworks/ folder

Interesting to note that they mention the following about versions > 4.4.0 of the Lottie framework:

We distribute XCFramework bundles for each release on GitHub. In Lottie 4.4.0 and later, these XCFramework bundles include a code signature. These bundles are self-signed under the name "Lottie iOS" and have the following fingerprint: When using lottie-spm, the downloaded Lottie.xframework isn't visible in the project navigator. To validate the authenticity of a lottie-spm package, you can confirm that the Package.swift file references a binary XCFramework from https://github.com/airbnb/lottie-ios/releases

I assume it is okay code sign this framework again. I tried importing the framework manually and setting “Embed without Codesign” and my app won’t build.

Here are the details from otool -l:

otool -l /Applications/Play\ 2\ -\ Beta.app/Contents/MacOS/Play\ 2\ -\ Beta | grep -B 1 -A 2 LC_RPATH
Load command 88
          cmd LC_RPATH
      cmdsize 40
         path @loader_path/../Frameworks (offset 12)
Load command 89
          cmd LC_RPATH
      cmdsize 48
         path @executable_path/../Frameworks (offset 12)
--
Load command 88
          cmd LC_RPATH
      cmdsize 40
         path @loader_path/../Frameworks (offset 12)
Load command 89
          cmd LC_RPATH
      cmdsize 48
         path @executable_path/../Frameworks (offset 12)

otool -l /Applications/Play\ 2\ -\ Beta.app/Contents/MacOS/Play\ 2\ -\ Beta | grep -B 1 -A 2 LC_ID_DYLIB

LC_ID_DYLIB is returning no value, assuming that could be a problem?

Disable Library Validation

Why? Disabling library validation is rarely the right option. It make sense if your app needs to load in-process plug-ins from other third-party developers, but in most other cases it causes more problems than it solves.

The Lottie.framework does exist in the <.app>/Resources/Frameworks/ folder

That’s wrong. In a macOS app, frameworks should be in Contents/Frameworks. See Placing Content in a Bundle.

I tried importing the framework manually and setting “Embed without Codesign” and my app won’t build.

Right. That’s taking you in the wrong direction. As a general rule, you want to sign all the code that you embed in your app.

LC_ID_DYLIB is returning no value, assuming that could be a problem?

For your app? No. Only dynamic libraries (and hence frameworks) need an LC_ID_DYLIB.


Since last working on this thread, I’ve written An Apple Library Primer to explain many of the concepts that cause confusion in this space. That references Dynamic Library Identification, which describes how to set this stuff up correctly. Based on what you’ve posted, it seems like the Lottie framework is doing the wrong thing, so you just need to sort out the ‘client’ side of this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Missing Library Error in Mac Catalyst when distributed through Testflight
 
 
Q