Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

ios - Class X is implemented in both <framework> and <application> one of the two will be used, which one is undefined

I'm getting this warning:

Class X is implemented in both <framework> and <application> one of the two will be used, which one is undefined

This warning is covered quite a bit across the web but i haven't found anything that answers the specific problem I'm having.

Scenario

I've built MyFramework and MyApplication (as a test/demo application for MyFramework).

MyFramework uses a CocoaPod (which I'll refer to as CoolPod), which I also want to use in MyApplication (and it is reasonable to assume a consumer of MyFramework would also).

I need to be able to distribute MyFramework as a .framework (for closed source). However, this means that MyFramework embeds CoolPod in its compiled library.

Now when I import MyFramework and CoolPod into MyApplication I get this conflict (outputting the warning shown above) as CoolPod's classes are already included in MyFramework's library (as CoolPod is embedded).

So we have this structure:

CoolPod -> MyFramework 
                        MyApplication
               CoolPod /

Question

How do I avoid this conflict?

  • Is there a way to my MyApplication provide CoolPod to MyFramework?
  • Do I have to pipe CoolPod's headers through MyFramework?

I've thought about including CoolPod's headers (but not its lib) in MyApplication, however this seems overly complex for what should be a simple case.

Any help is greatly appreciated, this is really blocking me right now.

Thanks,

Indigo

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For closed-source static libraries we recommend cocoapods-packager. I'm not sure it's support for frameworks though.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...