简体   繁体   English

如何在新的iOS8框架目标中链接Cocoapods生成的框架

[英]How to link an framework generated by Cocoapods in a new iOS8 framework target

I'm trying to create an iOS framework which I can use in many other iOS projects, and this framework has some dependencies, I need to use AFNetworking and Mantle libraries, I have created new project and podfile containing 我正在尝试创建一个可以在许多其他iOS项目中使用的iOS框架,并且该框架具有一定的依赖性,我需要使用AFNetworking和Mantle库,我创建了包含以下内容的新项目和podfile

platform :ios, '8.0'
use_frameworks!

pod 'Mantle', '~> 2.0'
pod 'AFNetworking', '~> 2.5'

and I run pod install, after cocoapods generate an workspace, after that I add new target to my project which is iOS8 framework, in this framework settings "General/Linked Frameworks and Libraries click + butotn and select AFNetworking and Done, after i'm trying to build my project but I get this Error 然后在cocoapods生成工作空间后运行pod install,然后将新目标添加到我的iOS8框架项目中,在此框架设置中,“常规/链接框架和库单击+ butotn并选择AFNetworking并完成,试图建立我的项目,但出现此错误

ld: warning: directory not found for option '-F/Users/borinschiivan/Desktop/ImodeveloperSDK/build/Debug-iphoneos/Pods' ld: framework not found AFNetworking clang: error: linker command failed with exit code 1 (use -v to see invocation) ld:警告:找不到选项'-F / Users / borinschiivan / Desktop / ImodeveloperSDK / build / Debug-iphoneos / Pods'的目录ld:找不到框架AFNetworking clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

You can download this test project here . 您可以在此处下载该测试项目。

You need not do this step " in this framework settings in this framework settings, General/Linked Frameworks and Libraries click + button and select AFNetworking and Done" 您无需在此框架设置中的“此框架设置中的“常规/链接框架和库”中单击+按钮并选择AFNetworking and Done”中执行此步骤

All the linking would be done automatically by cocoa pods. 所有链接将由可可豆荚自动完成。

Note : Since you are building a library, read pod spec for creating reusable component. 注意 :由于您正在构建库,因此请阅读Pod规范以创建可重复使用的组件。 you can create your ImodeveloperKit as pod framework and specify AFNetowrking as a dependency for your framework in cocoa pod specification. 您可以将ImodeveloperKit创建为Pod框架,并在可可豆规范中将AFNetowrking指定为框架的依赖项。

Edit: using link_with and specifying all the target solved the issue 编辑:使用link_with并指定所有目标可解决问题

platform :ios, '8.0'
pod "AFNetworking", "~> 2.5"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM