How to make facebook login in iOS 6?

My application uses facebook login to authenticate users, I heard about facebook integration included in iOS SDK itself,

Now, if the integration becomes inside iOS, I can use it to enter the system without importing the SDK on facebook and how, if so? will my app also launch iOS 6 as a release target?

+3
source share
2 answers

Well, first of all, you should add Social.framework to your project.

Step 2 : you need to import two classes. Import the required classes.

 #import <Social/Social.h> #import <Accounts/Accounts.h> 

Step 3 I am advancing on the assumption that you have a button for Facebook in your application. On the button, click these lines. You made.: -)

 - (IBAction)facebookButtonClicked:(id)sender { if([SLComposeViewController isAvailableForServiceType: SLServiceTypeFacebook]) { // Facebook Service Type is Available SLComposeViewController *slVC = [SLComposeViewController composeViewControllerForServiceType: SLServiceTypeFacebook]; SLComposeViewControllerCompletionHandler handler = ^(SLComposeViewControllerResult result) { if (result == SLComposeViewControllerResultCancelled) { NSLog(@"Cancelled"); } else { NSLog(@"Done"); } [slVC dismissViewControllerAnimated:YES completion:Nil]; }; slVC.completionHandler = handler; [slVC setInitialText:@"Test Post from iOS6"]; [slVC addURL:[NSURL URLWithString:@"http://www.apple.com"]]; [slVC addImage:[UIImage imageNamed:@"someimage.png"]]; [self presentViewController:slVC animated:YES completion:Nil]; } else { NSLog(@"Service Unavailable!!!"); } } 

The above are the main steps. For more information, you can contact This .

Change For Facebook user information, see.

Happy coding. :-)

+12
source

You need to import the SDK 3.x anyway. The only difference in registration logins is that if the user is already logged in with the integrated Facebook integration, your application will not be sent to the background image while the user is trying to log in. other words Login does not open the facebook web page or perhaps the facebook app installed. Ios shows uilaertview which says that the application wants to access Facebook ant thats all.It, when the user clicks OK, the application will be shown and you can see it on the settings application is disabled.

From the point of view of implementation, this does not matter. You can use the tutorial on the developerWorks home page.

http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/

+2
source

All Articles