我正在尝试创建一个可以在许多其他 iOS 项目中使用的 iOS 框架,而这个 框架有一些依赖性,我需要使用 AFNetworking 和 Mantle 库,我有 创建了新的项目和 podfile 包含
platform :ios, '8.0'
use_frameworks!
pod 'Mantle', '~> 2.0'
pod 'AFNetworking', '~> 2.5'
然后我运行 pod install,在 cocoapods 生成一个工作区之后,我将新目标添加到我的项目中 这是iOS8框架,在这个框架设置“General/Linked Frameworks and Libraries 单击 + 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)
您可以下载这个测试项目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"
所有链接都将由 cocoa pods 自动完成。
注意:由于您正在构建库,因此请阅读 pod 规范以创建可重用组件。您可以将 ImodeveloperKit 创建为 pod 框架,并在 cocoa pod 规范中将 AFNetowrking 指定为框架的依赖项。
编辑:使用 link_with 并指定所有目标解决了问题
关于ios - 如何在新的 iOS8 框架目标中链接由 Cocoapods 生成的框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30390724/