Old libraries, new CocoaPods

血红的双手。 提交于 2019-11-30 21:54:35
cojoj

As I thought... This example which I provided in OP is incorrect... Well, basically it's correct because it's working like it should. Let me show you a counter example.

I have a Swift project but I want to use only Objective-C pods (AFNetworking, SSPullToRefresh etc.). Now we have some troubles because when you provide those Objective-C pods in Podfile they'll be added to Pods target as a static libraries. You probably now that CocoaPods are now switching to Frameworks (If you want to know the difference please read this question). Back to topic... There are two possible solutions to this conflict sitation:

  1. You manually create YourProject-Bridging-Header.h and #import those libraries... This is the old way used even before Swift integration.
  2. You include this magic use_frameworks! method call inside your Podfile. By doing this you force CocoaPods to create frameworks instead of static libraries.

Now, let me explain why you'd prefer the second solution... As OP states, CocoaPods now automatically create Umbrella Headers (learn about them). It's the convenient way for you to skip manual creation of bridging header.

I've found a solution here so without this post I would probably still be struggling with this problem. Cheers to the author!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!