Reputation: 121
So I have a framework i need to distribute closed source so I created an XCFramework from it.
I have a parent framework, lets call it FrameworkA, it has a dependency of Framework B, Framework C, and Framework D. Framework B also has a dependency on Framework C. I created this chart to help illustrate:
Im using a dependency manager to link all of this and I need to add Cocoapods support (SPM is a separate issue) so this framework can be used by RN developers too, so I created some podspecs.
Example of how podspecs are structured
Pod::Spec.new do |s|
s.name = "ParentFramework"
s.version = "1.0.0"
s.summary = "ParentFramework Summary"
s.description = "ParentFramework description"
s.homepage = "http://example.com/"
s.license = "Private"
s.author = { "Example" => "example@example.com" }
s.source = { :http => 'https://example.com/ParentFramework.xcframework.zip' }
s.platform = :ios, '16.4'
s.requires_arc = true
s.swift_version = '5.0'
s.dependency 'MyFrameworkB'
s.dependency 'MyFrameworkC'
s.vendored_frameworks = 'ParentFramework.xcframework'
end
Pod::Spec.new do |s|
s.name = "MyFrameworkB"
s.version = "1.0.0"
s.summary = "MyFrameworkB Summary"
s.description = "MyFrameworkB description"
s.homepage = "http://example.com/"
s.license = "Private"
s.author = { "Example" => "example@example.com" }
s.source = { :http => 'https://example.com/MyFrameworkB.xcframework.zip' }
s.platform = :ios, '16.4'
s.requires_arc = true
s.swift_version = '5.0'
s.dependency 'MyFrameworkC'
s.vendored_frameworks = 'MyFrameworkB.xcframework'
end
and MyFrameworkC would look like
Pod::Spec.new do |s|
s.name = "MyFrameworkC"
s.version = "1.0.0"
s.summary = "MyFrameworkC Summary"
s.description = "MyFrameworkC description"
s.homepage = "http://example.com/"
s.license = "Private"
s.author = { "Example" => "example@example.com" }
s.source = { :http => 'https://example.com/MyFrameworkC.xcframework.zip' }
s.platform = :ios, '16.4'
s.requires_arc = true
s.swift_version = '5.0'
s.vendored_frameworks = 'MyFrameworkC.xcframework'
end
when i add MyFrameworkA to my podfile it will successfully retrieve MyFrameworkB and my project will compile and i can use public/open properties and methods from my frameworks. When i try to compile i get the following error:
dyld[99145]: Symbol not found: _$s14MyFrameworkBE16myFrameworkBMethod7request6resultyAD03AddhI7RequestC_ys6ResultOyAA15GenericResponseCs5Error_pGctF
Referenced from: <1DA0CCF4-9E68-31D5-AEE0-F007A3D478B5> /Users/myname/Library/Developer/CoreSimulator/Devices/F95AE061-9472-49BE-A4C4-CDD0513BDC1E/data/Containers/Bundle/Application/C1E7F412-2683-4F93-9625-FB1E86FF6470/TestApp.app/Frameworks/MyFrameworkB.framework/MyFrameworkB
Expected in: <57DF18F9-9F16-3DC5-B464-AAB4BFA5F0B0> /Users/myname/Library/Developer/CoreSimulator/Devices/F95AE061-9472-49BE-A4C4-CDD0513BDC1E/data/Containers/Bundle/Application/C1E7F412-2683-4F93-9625-FB1E86FF6470/TestApp.app/Frameworks/MyFrameworkC.framework/MyFrameworkC
What am i missing to make this all work?
Upvotes: 0
Views: 22