ios - 无法编译 Parse + Facebook SDK(Apple Mach-O 链接器错误)
<p><p>我正在尝试将 Facebook SDK 添加到我的 iOS Parse 项目。我正在尝试</p>
<p>我按照设置说明 <a href="https://developers.facebook.com/docs/ios/getting-started" rel="noreferrer noopener nofollow">here</a> :</p>
<p>在我的桥接头中我添加了:</p>
<pre><code>#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
</code></pre>
<p><strong>到目前为止一切正常</strong>,但是当我尝试添加 loginToFacebook 代码时,我收到 <strong>Apple Mach-o Linker Error</strong></p>
<pre><code> 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");
}
}
</code></pre>
<p> <img src="/image/rnniR.png" alt="Error Screenshot"/> </p>
<p>知道我做错了什么吗? </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我已经完成了 parse+fb ,这就是我所做的:</p>
<p>我的桥头:</p>
<pre><code> #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>
</code></pre>
<p>我的构建阶段截图 <img src="/image/0bwjw.png" alt="screenshot"/> </p>
<p>在 AppDelegate.swift 中:</p>
<pre><code> 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: ?) -> Bool {
// Override point for customization after application launch.
Parse.enableLocalDatastore()
// Initialize Parse.
Parse.setApplicationId("",
clientKey: "")
return true
}
</code></pre>
<p>在我的 LoginViewController 中,我有 IBoulet 作为登录按钮</p>
<pre><code> 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.")
}
})
}
</code></pre>
<p>如果您还有问题,请告诉我</p></p>
<p style="font-size: 20px;">关于ios - 无法编译 Parse + Facebook SDK(Apple Mach-O 链接器错误),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31353207/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31353207/
</a>
</p>
页:
[1]