Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods framework cannot find file in another cocoapods framework

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.

enter image description here

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
like image 606
hgwhittle Avatar asked May 15 '15 15:05

hgwhittle


2 Answers

Please check the profile - AFNetworking version

Change to

pod 'AFNetworking', '~> 2.5.4'

and use

#import "AFHTTPRequestOperationManager.h"
like image 112
Binoy jose Avatar answered Oct 07 '22 09:10

Binoy jose


Finally I succeed in configuring AFNetworking with swift. This is the Podfile:

Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!  
pod 'AFNetworking', '~> 2.5'

Bridge_AFNetworking.h

#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()

    }

}
like image 2
Javier Calatrava Llavería Avatar answered Oct 07 '22 09:10

Javier Calatrava Llavería