如何在iOS 5中集成Facebook?

时间:2013-02-14 20:03:24

标签: ios facebook

我知道Apple创建社交框架,但我的应用程序仅适用于iOS 5,所以我需要知道实现它的其他方法是什么?

2 个答案:

答案 0 :(得分:1)

快速谷歌搜索带我直接访问facebook api开发者网站,其中包含有关此主题的信息

FacebookIOSTutorial

答案 1 :(得分:0)

用于发布文本和图片的社交框架,用户墙上的网址。 有代码可供使用。添加import语句

#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];
}

}