2016-10-02 76 views
2

使用的XCode 8.我手動添加的Facebook SDK到我的項目在我的雨燕3.0項目集成了最新的Facebook SDK 4.16.0時,我有一個問題 enter image description here的Xcode 8和斯威夫特無法建立目標C模塊「FBSDKLoginKit」

框架搜索路徑 enter image description here

我得到一個編譯錯誤說「無法構建模塊FBSDKLoginKit」。
Compiling Error

,當我瀏覽到FBSDKLoginKit.h,一個錯誤說沒有發現 'FBSDKLoginKit/FBSDKLoginButton.h' 文件。 File not found

我搜索了一下,發現這可能與Could not build module 'FBSDKCoreKit' For FacebookSDK 4有關。我嘗試了一些方法,但是,它還沒有解決。

我很感激你的幫助。謝謝。

回答

0

我遇到了同樣的問題。由於this link,我能夠解決這個問題。該鏈接實際上對於將我的swift項目與facebook sdk集成在一起非常有用。但是因爲這篇文章可能有些過時,所以我不得不做一些不同的事情。其中一個特別是我的appdelegate。這是我完成時的樣子。

import UIKit 
@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate { 

var window: UIWindow? 


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    // Override point for customization after application launch. 
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) 
} 

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

func applicationWillResignActive(_ application: UIApplication) { 
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 
} 

func applicationDidEnterBackground(_ application: UIApplication) { 
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
} 

func applicationWillEnterForeground(_ application: UIApplication) { 
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 
} 

func applicationDidBecomeActive(_ application: UIApplication) { 
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    FBSDKAppEvents.activateApp() 
} 

func applicationWillTerminate(_ application: UIApplication) { 
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
} 
} 

所以基本上下面的鏈接將是有益的,但你應該讓你的appdelegate.swift,特別是application功能和applicationDidBecomeActive功能樣子就像我上面粘貼。

同樣在創建橋頭文件後,將其添加到項目構建設置看起來像這樣。

在鏈接它說,它應該包括項目的類似目錄這樣: projectName/Bridging-Header.h但是當我試過了,似乎它已經從我的項目目錄中查找所以它結束了找我頭文件在projectName/projectName/Bridging-Header.h這是一個無效的路徑。所以我像上面的截圖一樣添加了我的內容。