I am making a xcframework. In my framework project, I have added cocoa pods like Alamofire, Realm, and more. When I integrate my xcframework in my application, the application crashes showing following error:
dyld: Symbol not found: _$s9Alamofire10HTTPMethodO3getyA2CmFWC
Referenced from: /private/var/containers/Bundle/Application/E81F9FBA-3876-4959-B675-B89A4EC0257A/BykesPod.app/Frameworks/MYFRAMEWORK.framework/MYFRAMEWORK
Expected in: /private/var/containers/Bundle/Application/E81F9FBA-3876-4959-B675-B89A4EC0257A/DEMOAPP.app/Frameworks/Alamofire.framework/Alamofire
in /private/var/containers/Bundle/Application/E81F9FBA-3876-4959-B675-B89A4EC0257A/DEMOAPP.app/Frameworks/MYFRAMEWORK.framework/MYFRAMEWORK
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
Following is the pod file of my framework project
target 'MYFRAMEWORK' do
project './MYFRAMEWORK.xcodeproj'
pod 'Realm'
pod 'RealmSwift'
pod 'Alamofire', '~> 4.8'
pod 'MBProgressHUD','1.1.0'
pod 'SwiftyJSON'
end
I have added following dependencies in my podspec file:
s.dependency "Realm"
s.dependency "RealmSwift"
s.dependency "Alamofire","~> 4.8.2"
s.dependency "MBProgressHUD","~> 1.1.0"
s.dependency "SwiftyJSON"
Following is the pod file of my demo application:
target 'DEMOAPP' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'PODNAME'
end
Following are the commands from which I am making xcframeworks
xcodebuild archive -workspace MYFRAMEWORK.xcworkspace -scheme MYFRAMEWORK -sdk iphoneos -archivePath "archives/0/ios_device.xcarchive" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
xcodebuild archive -workspace MYFRAMEWORK.xcworkspace -scheme MYFRAMEWORK -sdk iphonesimulator -archivePath "archives/0/ios_simulators.xcarchive" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
xcodebuild -create-xcframework -framework archives/0/ios_device.xcarchive/Products/Library/Frameworks/MYFRAMEWORK.framework -framework archives/0/ios_simulators.xcarchive/Products/Library/Frameworks/MYFRAMEWORK.framework -output build/MYFRAMEWORK.xcframework
Note: My code xcode version is 12.4
