未解决的loginManager Facebook SDK swift3

时间:2017-05-05 13:16:36

标签: ios facebook swift3 cocoapods

我在swift3中使用Facebook SDK

Frist int my pod:

target ‘ProcIOS’ do
pod 'MOCA'
pod 'Toast-Swift', '~> 2.0.0'
pod 'AMTooltip'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'FacebookCore'
pod 'FacebookLogin'
use_frameworks!
end

第二,标题

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

第三

的appdelegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        MOCA.initializeSDK()
        FIRApp.configure()
        let bool = SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
        FBSDKProfile.enableUpdates(onAccessTokenChange: true)
        return bool
    }

 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
        return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
    }

最后在我的应用中:

import FacebookCore
import FacebookLogin
let loginManager = LoginManager()

Show me: Use unresolved identifier LoginManager

我清理项目,重新安装可可豆荚,删除除Facebook sdk以外的所有豆荚,但结果是一样的吗? 我做错了什么?

1 个答案:

答案 0 :(得分:2)

编辑您的appdelegate,如下所示:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
     return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

import FacebookCore