I'm working with a library installed via Cocoapods that depends on AFNetworking as a linked framework. After I installed the library, my project will not compile because imported AFNetworking files can not be found.
However, it seems that modules are causing the problem because if I change the import from:
#import "AFHTTPRequestOperationManager.h"
to
#import <AFNetworking/AFHTTPRequestOperationManager.h>
..the error disappears. I'd rather not go about changing code in these linked libraries, so how can I get my library to successfully find the AFNetworking files?
EDIT Here's my podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
target 'Motospot' do
pod 'Alamofire', '~> 1.2'
pod 'youtube-ios-player-helper', '~> 0.1.1'
pod 'BDBOAuth1Manager'
end
target 'MotospotTests' do
end
Please check the profile - AFNetworking version
Change to
pod 'AFNetworking', '~> 2.5.4'
and use
#import "AFHTTPRequestOperationManager.h"
Finally I succeed in configuring AFNetworking with swift. This is the Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'AFNetworking', '~> 2.5'
#ifndef eShop_Bridge_AFNetworking_h
#define eShop_Bridge_AFNetworking_h
#import <AFNetworking/AFNetworking.h>
#endif
This is some sample code using AFNetworking.
import UIKit
import AFNetworking
class DataManager: NSObject {
static let sharedInstance = DataManager()
let manager:AFHTTPRequestOperationManager = AFHTTPRequestOperationManager()
override init() {
super.init()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With