简体   繁体   中英

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

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

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)

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"

All the linking would be done automatically by cocoa pods.

Note : Since you are building a library, read pod spec for creating reusable component. you can create your ImodeveloperKit as pod framework and specify AFNetowrking as a dependency for your framework in cocoa pod specification.

Edit: using link_with and specifying all the target solved the issue

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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