iOS-Framework icon indicating copy to clipboard operation
iOS-Framework copied to clipboard

Can I use cocoapods in my framework?

Open wenzhaot opened this issue 9 years ago • 4 comments

Can I use cocoapods in my framework?

wenzhaot avatar Jul 16 '15 10:07 wenzhaot

Based on my experience: You can, but you can not ship static Libs inside your static lib. So, you has to remove the reference to the libPod.a to be able to compile and build the .framework. Then, you have to notify to the user of your framework that you have dependencies. That need to be installed using cocoa pods. Hope it helps. Good luck!

jonathanpdiaz avatar Jul 16 '15 12:07 jonathanpdiaz

I have a project A, I drag a static lib project B to A for build framework, and I use cocoapods in project A, so the question is Can I use cocoapods libs in static lib project B ?

wenzhaot avatar Jul 17 '15 02:07 wenzhaot

I did something that sounds like that, this was my setup: Project A, main Project with cocoa pods. (demo app for my framework) Project B, Framework using cocoa pods. (that builds the .framework fat file)

Since the framework is basically a static lib, I can not add libs (libPod.a is a static lib) inside. It won't compile. But, what I can do is use cocoa pods to write the framework code (having access to the dependencies headers), but to make it work I need to remove the libPod.a dependency from "Link Binary with Libraries" in the project B. That way, I have access to the headers of the libs from cocoa pods but when you build your .Framework it won't complain about trying to ship a lib with a lib inside.

Be aware that each time you run pod install, the libPod.a will be re linked to your project.

Then, in the podfile in project A, I need to set the same dependencies that I had in podfile in project B and it should build without problem. Then, I publish in cocoa pods the Public Headers and the .framework file setting the dependencies to make it work.

Again, hope it helps. Big thanks to the guys that wrote iOS-Framework!

jonathanpdiaz avatar Jul 17 '15 04:07 jonathanpdiaz

https://github.com/wenzhaot/RW-iOSFramework This is a demo project, Can u help me?

wenzhaot avatar Jul 17 '15 08:07 wenzhaot