Luca Davanzo
Luca Davanzo

Reputation: 21520

InstagramKit integration in swift project

As suggest title, I need to use InstagramKit (3.5.0) pod (written in objective-c) in a new swift project.

So I install pod (pod install), then I create my InstagramSwift-Bridging-Header.h and add-import library:

 #import <InstagramKit/InstagramEngine.h>

Then, just building this empty project, I get:

/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:9:

note: in file included from

/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5: 
-(BOOL)application:(UIApplication *)application
                     ^ <unknown>:0: 

error: failed to import bridging header

'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h' 

Expected a type Failed to import bridging header

'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'

What could I miss?

enter image description here

Upvotes: 2

Views: 1214

Answers (1)

Luca Davanzo
Luca Davanzo

Reputation: 21520

After a lot of discussions with @eric-d, I probably find the problem in my podfile that was:

target "InstagramSwift" do 

pod 'InstagramKit', '3.5.0' 

end

So I deleted project and start again from an empty project using Podfile:

use_frameworks!
platform :ios, '8.0' 
pod 'AFNetworking', '~> 2.5' 
pod 'InstagramKit', '3.5.0'

Than I manually created SwitBridge.h and linked it in build settings.

Finally, in any swift file I can use instagramKit module, for example:

import InstagramKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let instagramEngine: InstagramEngine = InstagramEngine.sharedEngine()
    }

}

Probably, problem was that platform setting is missing.

edit

Also,

"use_frameworks!"

thanks to this answer.

Upvotes: 5

Related Questions