如何在嵌入式框架中使用Cocoapods?

编程入门 行业动态 更新时间:2024-10-28 00:29:35
本文介绍了如何在嵌入式框架中使用Cocoapods?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在一个新项目中使用嵌入式框架作为我的自定义视图,以利用Xcode 6中的新的@IBDesignable内容,我想使用Facebook的Pop来激活这些视图。我已经添加Pop到项目使用Cocoapods,但嵌入式框架没有访问这些文件('POP / pop.h'文件未找到)。 p>

我试图将Cocoapods相关的构建阶段从应用程序目标复制到自定义框架目标,但是它们不能按原样工作。 工作是将Pop文件夹直接复制到嵌入式框架中,但是Xcode告诉我,我必须改变所有的尖括号< POP / pop.h> ; 到引号POP / pop.h。

解决方案

假设在你的Podfile中,你使用的是 link_with'MyCustomFramework',其中'MyCustomFramework'是您的嵌入式框架名称,并且运行 pod install 。选择您的项目文件(右上角的蓝色),然后进入构建设置。然后,在项目文件(蓝色)和自定义框架目标(例如MyCustomFramework)中找到允许非模块化包含在框架模块中,并将其设置为 YES < - 橙色午餐盒图标)。

然后,您可以在您的主MyCustomFramework.h文件中包含可可豆。

只需在你的应用程序目标中导入'@import MyCustomFramework;',你就可以得到剩下的CocoaPods了。 (例如,显示你从ObjectiveSugar访问每个)。

您应该这样做或不是一个单独的问题,但这允许您的自定义框架本身包括CocoaPods库,这允许应用程序目标只包括您的自定义框架,并获得所有的CocoaPods。

对于多张图片很抱歉,但我喜欢视觉化。

I'm using an embedded framework for my custom views in a new project to take advantage of the new @IBDesignable stuff in Xcode 6 and I'd like to animate said views with Facebook's Pop. I've added Pop to the project using Cocoapods but the embedded framework doesn't have access to those files ('POP/pop.h' file not found).

I tried copying the Cocoapods-related build phases from the app target to the custom framework target but they don't work as-is. What does work is copying the Pop folder into the embedded framework directly, but then Xcode tells me that I've gotta change all of the angle brackets <POP/pop.h> to quotes "POP/pop.h". I'm assuming there's a better way and I'm blanking on it.

解决方案

Assuming in your Podfile you are using the link_with 'MyCustomFramework', where 'MyCustomFramework' is your embedded framework name, and have run pod install. Select your Project file (Blue on the top right) and go into "Build Settings". Then, find 'Allow non-modular includes in Framework Modules' and set it to YES, for both the Project file (blue) and the Custom Framework target (ex. MyCustomFramework - orange "lunchbox case" icon).

Then you can include cocoa pods stuff in your main MyCustomFramework.h file.

Then just import '@import MyCustomFramework;' in your Application target, and you'll get the rest of the CocoaPods at your disposal. (Ex. showing you access to 'each' from ObjectiveSugar).

Whether you should do this or not is a separate issue, but this allows your Custom Framework to include the CocoaPods libraries in itself, which then allows the Application target to just include your Custom Framework and gets all the CocoaPods as well.

Sorry for the multiple images, but I like to be visual.

更多推荐

如何在嵌入式框架中使用Cocoapods?

本文发布于:2023-11-03 13:34:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555247.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌入式   框架   如何在   Cocoapods

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!