简体   繁体   中英

How do I install the facebook sdk for ios?

How do I install the Facebook SDK for iOS?

The download from the facebook developer website is failing, every time.

So, I got it from github: https://github.com/facebook/facebook-ios-sdk

But, I don't know what script to run, file to execute, thing to build, or...anything, to get to the next step in the process, which is to add the built facebook sdk to my xcode project. Anything I try to run (eg sh build_all.sh, etc.) doesn't work.

  1. Go here and click download: https://developers.facebook.com/docs/ios
  2. Install package.
  3. Find FacebookSDK folder, and in there you have FacebookSDK.framework.
  4. Go to your project, open settings, go to Info. Add 2 variables to Custom iOS Target Properties.
    a) FacebookAppID (String), with your app id from the facebook: eg 543523965389292
    b) FacebookDisplayName (String) with your name you want to display.
  5. In the same Info tab expand URL Types and add new one. Paste in the URL Scheme fb_APP_ID_, eg fb543523965389292.
  6. Go to Build Phases, expand Link Binary With Libraries. Add the FacebookSDK.framework from the point 2.
  7. In your AppDelegate.m add: #import <FacebookSDK/FacebookSDK.h> . And replace function in your AppDelegate.m.

     - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { // Call FBAppCall's handleOpenURL:sourceApplication to handle Facebook app responses BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication]; // You can add your app-specific url handling code here if needed return wasHandled; } 

Slightly older thread but to provide a clue: there's a bug report on Facebook DEV as more people are facing the same issue. Let's hope they'll fix it asap.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM