开发者

Implementing Facebook into Xcode Project

开发者 https://www.devze.com 2023-02-18 16:06 出处:网络
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:

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:

Implementing Facebook into Xcode Project

I really don't know how to use the GitHub repository and add it to my app project, so I hope开发者_StackOverflow社区 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:

Implementing Facebook into Xcode Project

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)


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.


for github, go to http://help.github.com/ they have loads of resources to help you out, but you pretty much just need to type git clone , and then find where it has put the repository.

alternatively if you browse to the repo on the github website, you should be able to just click a download button.

with the second bit, what do you need help with?

the app id will be from when you have set your application up in facebook.

0

精彩评论

暂无评论...
验证码 换一张
取 消