我正在尝试使用将Facebook SDK添加到我的iOS Parse Project。我在尝试着

我遵循了安装说明here:

在我的桥接标题中,我添加了:

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

到目前为止,一切都可以正常编译,但是当我尝试添加loginToFacebook代码时,我收到了苹果Mach-o链接器错误
   var permissionArray = ["user_about_me","user_relationships","user_relationships","user_location"];

    PFFacebookUtils.logInInBackgroundWithReadPermissions(permissionArray) { (user: PFUser?, error: NSError?) -> Void in
        if (user == nil) {
            println("Canceled the Facebook login.");
        } else if (user!.isNew) {
            println("User signed up and logged in through Facebook!");
        } else {
            println("login through Facebook");
        }
    }

知道我做错了什么吗?

最佳答案

我已经完成了parse + fb,这是我所做的:

我的桥头:

 #import <FBSDKCoreKit/FBSDKCoreKit.h>
 #import <FBSDKLoginKit/FBSDKLoginKit.h>
 #import <Parse/Parse.h>
 #import <Parse/PFObject+Subclass.h>
 #import <ParseUI/ParseUI.h>
 #import <ParseFacebookUtilsV4/PFFacebookUtils.h>
 #import <Bolts/Bolts.h>

我的构建阶段屏幕截图

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



    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    Parse.enableLocalDatastore()

    // Initialize Parse.
    Parse.setApplicationId("",
        clientKey: "")
    return true
}

在我的LoginViewController中,我有用于登录按钮的IBoulet
    var permissions = [ "public_profile", "email", "user_friends" ]

    @IBAction func facebookLogin(sender: AnyObject) {
    PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions,  block: {  (user: PFUser?, error: NSError?) -> Void in
        if let user = user {
            if user.isNew {
                println("User signed up and logged in through Facebook!")

            } else {
                println("User logged in through Facebook!")

            }
        } else {
            println("Uh oh. The user cancelled the Facebook login.")
        }
    })
}

让我知道您是否还有问题

10-06 00:22