XCFramework, dyld cache load error: shared cache file open() failed

2.4k Views Asked by At

Im struggling to get a framework working using XCFramework. I have built the arm64/armv7 and separate x86_64 frameworks as if they were normal cocoapods, then I use xcodebuild -create-xcframework to merge them into an xcframework which all works well. When i try use the framework afterwards though im getting this runtime error

dyld: dyld cache load error: shared cache file open() failed
dyld: Symbol not found: _$s6Lottie13AnimationViewC18backgroundBehaviorAA0a10BackgroundE0OvpWvd
  Referenced from: /Users/user/Library/Developer/CoreSimulator/Devices/BE671B8B-97A0-4449-BBC6-C1DFD857138D/data/Containers/Bundle/Application/04DFC623-E380-45C6-A28F-0C36142F031E/MyFramework_Example.app/Frameworks/MyFramework.framework/MyFramework
  Expected in: /Users/user/Library/Developer/CoreSimulator/Devices/BE671B8B-97A0-4449-BBC6-C1DFD857138D/data/Containers/Bundle/Application/04DFC623-E380-45C6-A28F-0C36142F031E/MyFramework_Example.app/Frameworks/Lottie.framework/Lottie
 in /Users/user/Library/Developer/CoreSimulator/Devices/BE671B8B-97A0-4449-BBC6-C1DFD857138D/data/Containers/Bundle/Application/04DFC623-E380-45C6-A28F-0C36142F031E/MyFramework_Example.app/Frameworks/MyFramework.framework/MyFramework

I have searched around a lot for dyld type errors but none of them seem to be of this type and have solutions that dont seem to apply to my scenario.

The xcframework gets put into my project via cocoapods and has its dependancies defined in the podspec. As you can see from the error, its trying to use a symbol from the lottie framework which is one of my dependancies, but cant seem to find it which is weird. I've made sure the lottie framework is indeed being pulled into my project (and it works if i build from the source instead of the xcframework). So not sure why its having issues linking the framework.

Let me know if you need any more specific info to help

2

There are 2 best solutions below

0
On

try putting

pod 'lottie-ios', :git => 'https://github.com/airbnb/lottie-ios', :branch => 'master'

in your Podfile (without adding the post-install action).

They probably used a different Xcode version to compile between the latest released version and the master branch.

I know it's a workaround but saved my day.

1
On

you shouldn't have two files containg the main function in the same project !