Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing Facebook into Xcode Project

I am going to be implementing the facebook application into my project, but I've ran into some roadblocks. First I read about the link that developers.facebook.com has posted: enter image description here

I really don't know how to use the GitHub repository and add it to my app project, so I hope I can get some help with that,

Next, while I was continuing the rest, I found something that I might need help on as well: enter image description here

So that's all I have for now, I just need to get through this first part, then I can continue on, so I hope someone can help me get on through that first part, thanks

(sorry if I had to post the pictures, I just really need to be specific and I'm sometimes having trouble with reading tutorials)

like image 845
PatrickGamboa Avatar asked Aug 27 '26 22:08

PatrickGamboa


1 Answers

If you are not familiar with git you can download the sdk manually to your hard drive on this page: https://github.com/facebook/facebook-ios-sdk click on downloads and select the preferred format.

On the readme clearly states how to add the library to your own application:

If you want to integrate Facebook with an existing application, then follow these steps:

  • Copy the Facebook SDK into your Xcode project:

    • In Xcode, open the Facebook SDK by selecting File->Open... and selecting src/facebook-ios-sdk.xcodeproj.
    • With your own application project open in Xcode, drag and drop the "FBConnect" folder from the Facebook SDK project into your application's project.
    • Include the FBConnect headers in your code:

      #import "FBConnect/FBConnect.h"

    • You should now be able to compile your project successfully.

  • Register your application with Facebook:

    • Create a new Facebook application at: http://www.facebook.com/developers/createapp.php. If you already have a related web application, you can use the same application ID.
    • Set your application's name and picture. This is what users will see when they authorize your application.

You should have a file called yourProjectNameAppDelegate.h and yourProjectNameAppDelegate.m.

You have to put #import "FBConnect/FBConnect.h" into yourProjectNameAppDelegate.h. And declare a variable in the header Facebook* facebok; and also synthesize it.

Your yourProjectNameAppDelegate.m contains a method called application:didFinishLaunchingWithOptions: which should look like:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
   facebook = [[Facebook alloc] initWithAppId:@"YOUR_APP_ID"];
   [facebook authorize:permissions delegate:self];

}

Also put in this file the other method.

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    return [facebook handleOpenUrl:url];
}

Also I suggest to learn a bit more about objective-c, because your problems are not related to the facebook library. You can find plenty of resources on the net. I suggest to look this iTunes university screencast.

like image 152
dombesz Avatar answered Aug 30 '26 14:08

dombesz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!