简体   繁体   English

尝试将 Linkedin SDK 集成到我的 Swift 项目时出错

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

I am trying to integrate the Linkedin SDK into my Swift project.我正在尝试将 Linkedin SDK 集成到我的 Swift 项目中。 I am using this cocoapod and this is the error I'm getting.我正在使用这个 cocoapod ,这是我得到的错误。

Use of unresolved identifier 'LinkedinSwiftHelper'使用未解析的标识符“LinkedinSwiftHelper”

My podfile:我的播客文件:

use_frameworks!使用_框架!

target 'JobRewards' do pod 'LinkedinSwift', '~> 1.6.5'目标 'JobRewards' 做 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:我的 info.plist 源代码:

<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:在构建设置/Objective-C 桥接标头上,这是当前路径:

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

Thanks in advance for any help, I have been struggling with this for 2 days.在此先感谢您的帮助,我已经为此苦苦挣扎了 2 天。

You shouldn't need the bridging header when using cocoa pods.使用可可豆荚时,您不需要桥接头。 Are you importing LinkedInSwift in the Swift file that includes that viewcontroller?您是否在包含该视图控制器的 Swift 文件中导入 LinkedInSwift? For me, this compiled with no issues.对我来说,这个编译没有问题。

import UIKit
import LinkedinSwift

class ViewController: UIViewController {

    let linkedinHelper = LinkedinSwiftHelper()

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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