OStack程序员社区-中国程序员成长平台

标题: ios - 无法编译 Parse + Facebook SDK(Apple Mach-O 链接器错误) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:49
标题: ios - 无法编译 Parse + Facebook SDK(Apple Mach-O 链接器错误)

我正在尝试将 Facebook SDK 添加到我的 iOS Parse 项目。我正在尝试

我按照设置说明 here :

在我的桥接头中我添加了:

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

到目前为止一切正常,但是当我尝试添加 loginToFacebook 代码时,我收到 Apple Mach-o Linker Error

   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");
        }
    } 

Error Screenshot

知道我做错了什么吗?



Best Answer-推荐答案


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

我的桥头:

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

我的构建阶段截图 screenshot

在 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.")
        }
    })
}

如果您还有问题,请告诉我

关于ios - 无法编译 Parse + Facebook SDK(Apple Mach-O 链接器错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31353207/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4