Cocoapods: dyld: Symbol not found

Created on 8 May 2020  路  21Comments  路  Source: CocoaPods/CocoaPods

Report

Crash at app startup after integrating an XCFramework through CocoaPods, which at the same time depends on other pods:

dyld: Symbol not found: _$s10Kingfisher0A15OptionsInfoItemO9processoryAcA14ImageProcessor_pcACmFWC
  Referenced from: /Users/***/Library/Developer/Xcode/DerivedData/<project_name>-drylsvbxshkhsdcwpcdbkpqcwncq/Build/Products/Debug-iphonesimulator/<MyFramework>.framework/<MyFramework>
  Expected in: /Users/***/Library/Developer/CoreSimulator/Devices/1CF36C57-E49E-4723-9E6B-B0982CFD3A8B/data/Containers/Bundle/Application/D1C63F1B-89D1-440A-8280-E361CD00566F/<project_name>.app/Frameworks/Kingfisher.framework/Kingfisher
 in /Users/***/Library/Developer/Xcode/DerivedData/<project_name>-drylsvbxshkhsdcwpcdbkpqcwncq/Build/Products/Debug-iphonesimulator/<MyFramework>.framework/<MyFramework>

What did you do?

We have an SDK which depends on some pods. We currently bundle this SDK to a fat binary framework. We now want to bundle it using the new XCFramework format and distribute it through CocoaPods as a binary.
After including the binary to a project and run the app, we get this runtime crash on app startup.

We build the xcframework with the BUILD_LIBRARY_FOR_DISTRIBUTION flag set to YES.

This is our .podspec:

...
s.vendored_frameworks = '<MyFramework>.xcframework'
s.swift_version = '5.0'
...
s.dependency 'Kingfisher', '~>5.13.4'
...

What did you expect to happen?

App runs normally with the SDK installed via CocoaPods.

What happened instead?

Runtime crash on app startup

CocoaPods Environment

Stack

   CocoaPods : 1.9.1
        Ruby : ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
    RubyGems : 3.0.6
        Host : Mac OS X 10.15.3 (19D76)
       Xcode : 11.4.1 (11E503a)
         Git : git version 2.24.2 (Apple Git-127)
Ruby lib dir : /Users/***/.rvm/rubies/ruby-2.6.5/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ 41a3bd8cfd73f4314312dad7dab715275484b120
               trunk - CDN - https://cdn.cocoapods.org/
               <a private repository where our SDK is>

Installation Source

Executable Path: /Users/***/.rvm/gems/ruby-2.6.5/bin/pod

Plugins

claide-plugins        : 0.9.2
cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

source 'https://cdn.cocoapods.org/'
source '<private repo>'

platform :ios, '11.0'

use_frameworks!

target '<project_name>' do
  pod '<MyFramework>', path: '../<MyFramework>.podspec'
end
awaiting input need sample

Most helpful comment

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

All 21 comments

A repro would help to investigate

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

@rserentill facing a similar issue, did you ever figure this out?

@rserentill facing a similar issue, did you ever figure this out?

No.. I'm still having the same problem :/

@nikitaame , @rserentill : I'm also struggling with this issue. Did you somehow solve this issue?

Any news on this issue?? @renescholze @nikitaame @rserentill I'm also facing this problem

Same here... any updates on this?

Same here...

I have opened a new issue here incase if it helps anyone with sample repo code reference in it as well : https://github.com/CocoaPods/CocoaPods/issues/10185

@paulb777 can you please help me with this issue, I think last time you were looking for a sample repo you can find all this in my new issue raised here https://github.com/CocoaPods/CocoaPods/issues/10185

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

@mayaTest you are top class , saviour, saved my day. Thank you so much, I added the script to client app and it worked, Adding it to the framework does not help but adding to the client app does the trick.

Since 1.10 the Build library for distribution setting of a target is inherited by its pods (see #9232 and 37cc010). So instead of the post_install hook activating that build setting for your app target also does the trick (+ running pod install again).

Maybe though this has some side effects I'm not aware of...

@mayaTest Thank you so much!

@mayaTest You saved my month 馃槶. Thank you very much.

@mayasomase It looks like you've done a great thing here. My question is do you know why this works?

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end

Can this be injected via the podspec so that the end-user is saved some agony?

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end

@mayasomase you are my hero

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end

Can this solution be implemented in podspec?

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end

Can this solution be implemented in podspec?

Not sure I didn't tried that....My requirement was to create xcframeworl so I tried that only

add below line in the pod file which sets the Build library for distribution to yes for all pods. Then update/install the pods. It solves the problem of crashing app at runtime
Add this to pod file of application where u had added xcframework
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end

Can this be injected via the podspec so that the end-user is saved some agony?

Not sure I didn't tried that....My requirement was to create xcframeworl so I tried that only

Was this page helpful?
0 / 5 - 0 ratings