在使用XCode 8将最新的Facebook SDK 4.16.0集成到我的Swift 3.0项目中时,我遇到了一个问题。

框架搜索路径

我收到一个编译错误,说“无法构建模块FBSDKLoginKit”。

当我导航到FBSDKLoginKit.h时,一个错误提示'FBSDKLoginKit/FBSDKLoginButton.h‘file not found。

我搜索并发现这可能与Could not build module 'FBSDKCoreKit' For FacebookSDK 4相关。我尝试了一些方法,然而,它没有工作。
我很感谢你的帮助。谢谢。
发布于 2016-10-29 22:04:48
我也遇到过同样的问题。多亏了this link,我才能解决这个问题。这个链接实际上很有用,可以让我的swift项目与facebook sdk完全集成。但因为这篇文章可能有点过时了,我不得不做一些不同的事情。其中一个特别的是我的应用程序委托。这是我做完后的样子。
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中查找我的头文件,这是一个无效的路径。所以我像上面的截图一样添加了我的。
https://stackoverflow.com/questions/39813908
复制相似问题