简体   繁体   中英

Error when trying to integrate the Linkedin SDK into my Swift project

I am trying to integrate the Linkedin SDK into my Swift project. I am using this cocoapod and this is the error I'm getting.

Use of unresolved identifier 'LinkedinSwiftHelper'

My podfile:

use_frameworks!

target 'JobRewards' do pod 'LinkedinSwift', '~> 1.6.5'

end

This is the line where I am getting the error, I am declaring this right after the class declaration of my View Controller:

let linkedinHelper = LinkedinSwiftHelper(configuration: LinkedinSwiftConfiguration(clientId: "myclientid", clientSecret: "myclientsecret", state: "mystate", permissions: ["r_basicprofile", "r_emailaddress"]))

My bridging header:

#ifndef ObjectiveCHeader_h
#define ObjectiveCHeader_h

#import <LinkedinSwift/LSHeader.h> // this will use both for POD and import framework.


#endif /* ObjectiveCHeader_h */

My info.plist source code:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>linkedin.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>
<key>LIAppId</key>
<string>4594413</string>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>li4594413</string>
        </array>
    </dict>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>linkedin</string>
    <string>linkedin-sdk2</string>
    <string>linkedin-sdk</string>
</array>

On build settings/Objective-C bridging header this is the current path:

/Users/myName/Desktop/PROJECTS/MyProject/MyProject/ObjectiveCHeader.h

Thanks in advance for any help, I have been struggling with this for 2 days.

You shouldn't need the bridging header when using cocoa pods. Are you importing LinkedInSwift in the Swift file that includes that viewcontroller? For me, this compiled with no issues.

import UIKit
import LinkedinSwift

class ViewController: UIViewController {

    let linkedinHelper = LinkedinSwiftHelper()

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM