iPive
iPive

Reputation: 1

How can I integrate Facebook in iOS 5?

I know that Apple create Social framework but my app is only for iOS 5, so I need to know which are other ways to implement it?

Upvotes: 0

Views: 74

Answers (2)

Dinesh Patel
Dinesh Patel

Reputation: 142

Social framework used for posting text and images, url on user wall . There is code for use it. add import statement

#import <Social/Social.h>
- (IBAction)postToFacebook
{
 spinner.hidden=YES;
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
    SLComposeViewController *controller = [SLComposeViewController  composeViewControllerForServiceType:SLServiceTypeFacebook];

    [controller setInitialText:@"Check this Beautiful App of ASI Delhi Circle"];
   //[controller addImage:imageView1.image];
    [controller addURL:[NSURL URLWithString:@"http://play.google.com/store/apps/details?id=com.asidelhicircle"]];
    [self presentViewController:controller animated:YES completion:Nil];
}else
{
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:@"Please Login in Facebook application." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

    [alert show];
    [alert release];
}

}

 - (IBAction)postToTwitter
{
  if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
  {
    SLComposeViewController *tweetSheet = [SLComposeViewController
                                             composeViewControllerForServiceType:SLServiceTypeTwitter];
         [tweetSheet setInitialText:@"Check this Beautiful App of ASI Delhi Circle http://play.google.com/store/apps/details?id=com.asidelhicircle"];
    [self presentViewController:tweetSheet animated:YES completion:nil];
}else
{
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:@"Please Login in Twitter application." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

    [alert show];
    [alert release];
}

}

Upvotes: 0

twaldron
twaldron

Reputation: 2752

A quick google search took me right to the facebook api developers site with information on this very topic

FacebookIOSTutorial

Upvotes: 0

Related Questions