【问题标题】:Error when trying to integrate the Linkedin SDK into my Swift project尝试将 Linkedin SDK 集成到我的 Swift 项目中时出错
【发布时间】:2016-10-04 23:35:47
【问题描述】:

我正在尝试将 Linkedin SDK 集成到我的 Swift 项目中。我正在使用this cocoapod,这是我遇到的错误。

使用未解析的标识符“LinkedinSwiftHelper”

我的 podfile:

使用_frameworks!

目标“工作奖励”做 pod 'LinkedinSwift', '~> 1.6.5'

结束

这是我得到错误的那一行,我在我的视图控制器的类声明之后声明了这一点:

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

我的桥接头:

#ifndef ObjectiveCHeader_h
#define ObjectiveCHeader_h

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


#endif /* ObjectiveCHeader_h */

我的 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>

在构建设置/Objective-C 桥接头上,这是当前路径:

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

提前感谢您的帮助,我已经为此苦苦挣扎了 2 天。

【问题讨论】:

    标签: ios swift xcode podfile objc-bridging-header


    【解决方案1】:

    在使用可可豆荚时,您不应该需要桥接头。您是否在包含该视图控制器的 Swift 文件中导入 LinkedInSwift?对我来说,这个编译没有问题。

    import UIKit
    import LinkedinSwift
    
    class ViewController: UIViewController {
    
        let linkedinHelper = LinkedinSwiftHelper()
    
    }
    

    【讨论】:

    • 没问题。如果它只是您使用它的唯一用途,您可能希望删除该桥接头。
    猜你喜欢
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多