Install Xcode Swift pods - import file not found

I am working on a project in Xcode written in Swift. I use two containers, AFNetworkingand BDBOAuth1Manager. These are both Obj-C libraries, so a simple bridge file to import them takes care of everything.

Now the problem occurs when I try to enable the third module SwiftyJSON, which is written in Swift. Here's what the Podfile looks like:

platform :ios, "8.0"
use_frameworks!

pod "AFNetworking"
pod "BDBOAuth1Manager"
pod "SwiftyJSON"

link_with 'TwitterSearch', 'TwitterSearch Tests'

After installing the above Podfile, the header header stops working, because now it cannot find the files I'm trying to import.

In short, this is the header of the header file:

//
//  Use this file to import your target public headers that you would like to expose to Swift.
//

#import "BDBOAuth1RequestOperationManager.h"

It works when the Pods - it is just AFNetworkingand BDBOAuth1Managerthat are recorded in Obj-C. It does not work if the third module SwiftyJSONwritten in Swift is enabled .

Exact error messages:

  • Swift: "BDBOAuth1RequestOperationManager.h"
  • Swift:

    -

, ?

: , . SwiftyJSON, . : use_frameworks! , , :

#import "path/BDBOAuth1RequestOperationManager.h"

instead of

#import "BDBOAuth1RequestOperationManager.h"
0
3

Podfile

platform :ios, "8.0"
use_frameworks!

target 'SwiftAndObjCPods' do
pod "SwiftyJSON"
end

target 'SwiftAndObjCPodsTests' do
pod "SwiftyJSON"
end

:

AFNetworking BDBOAuth1Manager . , > > Finder .

Bridging-header.h

#import "AFNetworking.h"
#import "BDBOAuth1RequestOperationManager.h"

// No import
let a = BDBOAuth1RequestOperationManager(baseURL: baseURL, consumerKey: "consumer", consumerSecret: "secret")

: , , .

+2

Podfile

platform :ios, "8.0"
use_frameworks!

target 'ObjCSwiftPods' do
pod "AFNetworking"
pod "BDBOAuth1Manager"
pod "SwiftyJSON"
end

target 'ObjCSwiftPodsTests' do
pod "AFNetworking"
pod "BDBOAuth1Manager"
pod "SwiftyJSON"
end

-Bridging-

#import "../Pods/AFNetworking/AFNetworking/AFNetworking.h"
#import "../Pods/BDBOAuth1Manager/BDBOAuth1Manager/BDBOAuth1RequestOperationManager.h"

Bridging-Header:

../ {full path to Pods}/ , Xcode.

// necessary import
import SwiftyJSON

// test BDBOAuth1Manager
let url = NSURL(string: "http://ObjCSwiftPods.com")
let bdsm = BDBOAuth1RequestOperationManager(baseURL: url, consumerKey:"key", consumerSecret:"secret")

// test AFNetworking
let sec = AFSecurityPolicy()

// test SwiftyJSON
let json = JSON("{}")

+1

podfile

pod 'SwiftyJSON', '~> 2.2.1'
0

Source: https://habr.com/ru/post/1626074/


All Articles