如何在新的 iOS8 框架目标中 link Cocoapods 生成的框架
How to link an framework generated by Cocoapods in a new iOS8 framework target
我正在尝试创建一个 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 和 select 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 + 按钮和 select AFNetworking and Done
所有链接将由 cocoa pods 自动完成。
注意:由于您正在构建库,请阅读 pod 规范以创建可重用组件。您可以将 ImodeveloperKit 创建为 pod 框架,并在 cocoa pod 规范中将 AFNetowrking 指定为框架的依赖项。
编辑:使用 link_with 并指定所有目标解决了问题
platform :ios, '8.0'
pod "AFNetworking", "~> 2.5"
我正在尝试创建一个 iOS 框架,我可以在许多其他 iOS 项目中使用它,而这个 框架有一些依赖性,我需要使用 AFNetworking 和 Mantle 库,我有 创建了包含
的新项目和 podfileplatform :ios, '8.0'
use_frameworks!
pod 'Mantle', '~> 2.0'
pod 'AFNetworking', '~> 2.5'
我运行 pod install,在cocoapods生成工作空间后,我将新目标添加到我的项目中 这是iOS8框架,在这个框架设置“General/Linked Frameworks and Libraries 单击 + butotn 和 select 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 + 按钮和 select AFNetworking and Done
所有链接将由 cocoa pods 自动完成。
注意:由于您正在构建库,请阅读 pod 规范以创建可重用组件。您可以将 ImodeveloperKit 创建为 pod 框架,并在 cocoa pod 规范中将 AFNetowrking 指定为框架的依赖项。
编辑:使用 link_with 并指定所有目标解决了问题
platform :ios, '8.0'
pod "AFNetworking", "~> 2.5"