iosswiftxcodebuildxcframeworkswiftprotobuf

How to handle swift protobuf(Static library) dependency in xcframework generation


I have a SDK called ParentSDK and it have some dependency are swift-protobuf(Static library) and some private frameworkSDKs. Already add a podFile in my ParentSDK. Add all framework installation cocoa pod cmd in my podFile include swiftprotobuf. Compile and successfully generate xcFramework in my ParentSDK.

Then use my generated ParentSDK xcFramework in my XCodeApplication and try to run my application.

I have a crash while application launch, so can't run my application.

Crash log

dyld[8182]: Symbol not found: _$s13SwiftProtobuf19_ProtoNameProvidingP17_protobuf_nameMapAA01_dH0VvgZTq
  Referenced from: /Users/<Mac-Name>/Library/Developer/CoreSimulator/Devices/C1C95FC4-20C5-4C06-94D2-EFA435B83C04/data/Containers/Bundle/Application/97C2C91F-DDC8-49AE-8DE1-157C552B394D/XCWorkspaceBuildGenerationPractise.app/Frameworks/<ParentSDK>.framework/<ParentSDK>
  Expected in: /Users/<Mac-Name>/Library/Developer/CoreSimulator/Devices/C1C95FC4-20C5-4C06-94D2-EFA435B83C04/data/Containers/Bundle/Application/97C2C91F-DDC8-49AE-8DE1-157C552B394D/XCWorkspaceBuildGenerationPractise.app/Frameworks/SwiftProtobuf.framework/SwiftProtobuf
Symbol not found: _$s13SwiftProtobuf19_ProtoNameProvidingP17_protobuf_nameMapAA01_dH0VvgZTq
  Referenced from: /Users/<Mac-Name>/Library/Developer/CoreSimulator/Devices/C1C95FC4-20C5-4C06-94D2-EFA435B83C04/data/Containers/Bundle/Application/97C2C91F-DDC8-49AE-8DE1-157C552B394D/XCWorkspacePractise.app/Frameworks/<ParentSDK>.framework/<ParentSDK>
  Expected in: /Users/<Mac-Name>/Library/Developer/CoreSimulator/Devices/C1C95FC4-20C5-4C06-94D2-EFA435B83C04/data/Containers/Bundle/Application/97C2C91F-DDC8-49AE-8DE1-157C552B394D/XCWorkspacePractise.app/Frameworks/SwiftProtobuf.framework/SwiftProtobuf

I read some articles relate this issue, A lot of people says add swift-protobuf in your SDK locally. How to use this locally in my ParentSDK


Solution

  • Finally i found the reason of this error. Still am using multiple version of swiftProtobuf. Before am used this case in like compile my xcframework with swiftprotobuf in version 1, once the xcframework generates successfully, Then use this compiled xcframework in my project, the xcframework wants some dependency include swiftprotobuf, Now am add swiftProtobuf dependency in version 2. That is the reason of this error. So if anyone have this error, kindly once verify your dependency versions both are same.