问题
I'm developing a framework that requires use of AFNetworking. So I started by creating a new and shiny Cocoa Touch Framework and as usual I created a pod file with the following stuff in it:
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking', '~> 2.5'
Obviously on a normal project this would create the workspace and everything would be super smooth... But since I picked Cocoa Touch Framework I am not able to import AFNetowrking.h into my ProjectName.h. The error I'm getting is:
Include of non-modular header inside framework module...
So I actually looked this up! It seemed that all I need to do is to go to my build settings and set Allow Non-modular Includes In Framework Modules to yes and my problem will be solved... but that didn't help either.
Another thing I tried doing was to also set the target membership of AFNetworking.h header file to public. But that didn't resolve the issue and I'm still getting the same error.
I'd appreciate if anyone can give me a step by step mini guide on how to do this?
It is worth mentioning that I'd like to be able to use the AFNetworking library in swift as well.
回答1:
When importing a module using cocoapods in your source code you must import it like
#import <AFNetworking.h>
rather than
#import "AFNetworking.h"
回答2:
Here's my pod file:
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking', '~> 2.5'
use_frameworks!
You need to make sure you install the beta version of CocoaPod (0.36). The only issue with this is that you will be able to run it on iOS 7 but it will not pass the validation on apple application submission (keep that in mind).
来源:https://stackoverflow.com/questions/28374582/using-cocoapods-in-cocoa-touch-framework