Reputation: 2185
We created a IOS framework which is distributed to various people. But now we came across an interesting problem. We use protobuf in our framework and one of our clients started using Expo Kit which also recently included protobuf and now our client gets a crash with our framework:
Class Foo is implemented in both ... One of the two will be used. Which one is undefined.
We can't use the Cocoapods Protobuf-ios because it is outdated.
My only option that I can think of is to build the framework without our protobuf files included for this client. So our framework will then use their Expo Kit profobuf files. How do I go about doing this in Xcode or is there an alternative solution.
Edit:
What I want to achieve but just can't seem to get it right. I want to distribute my Framework without my Protobuf.a file. Protobuf.a must be a dependancy on the client apps.
Upvotes: 9
Views: 1264
Reputation: 3900
You don't need to link Protobuf in you client application, if it is already embedding/linking your framework which contains Protobuf.
In you client application, you can provide the path of the Protobuf embedded inside framework. You just need to modify the Framework Search Path
for client application and provide the path to protobuf embedded inside the framework.
Upvotes: 2
Reputation: 3439
You need to have a dynamic
link to the package and avoid embedding 3rd party binaries in your framework unless neccessary.
Checkout these articles, hope they help you:
https://theswiftdev.com/2018/01/25/deep-dive-into-swift-frameworks/ https://www.bignerdranch.com/blog/it-looks-like-you-are-trying-to-use-a-framework/
Also this is interesting one:
When should we use "embedded binaries" rather than "Linked Frameworks" in Xcode?
Upvotes: 2
Reputation: 684
Have you considered moving to another, more maintained, Protobuf
framework like the one from Apple (bonus points for being made for Swift
).
Hope it helps ;-)
Upvotes: 3