2

使用 XCode 8 在我的 Swift 3.0 项目中集成最新的 Facebook SDK 4.16.0 时遇到问题。我手动将 Facebook SDK 添加到我的项目中 在此处输入图像描述

框架搜索路径 在此处输入图像描述

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

当我导航到 FBSDKLoginKit.h 时,错误提示“找不到 FBSDKLoginKit/FBSDKLoginButton.h”文件。 文件未找到

我搜索并发现这可能与Could not build module 'FBSDKCoreKit' For FacebookSDK 4相关。我尝试了一些方法,但是,它没有成功。

我很感激你的帮助。谢谢你。

4

1 回答 1

0

我遇到了同样的问题。由于这个链接,我能够解决它。该链接实际上对于将我的 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该文件的路径无效。所以我像上面的截图一样添加了我的。

于 2016-10-29T14:04:47.847 回答