0

我知道 Apple 创建了社交框架,但我的应用程序仅适用于 iOS 5,所以我需要知道还有哪些其他方法可以实现它?

4

2 回答 2

1

一个快速的谷歌搜索把我带到了 facebook api 开发者网站,里面有关于这个主题的信息

FacebookIOS教程

于 2013-02-14T20:05:49.080 回答
0

用于发布文本和图像的社交框架,用户墙上的 url。有使用它的代码。添加导入语句

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

}

于 2014-02-05T07:13:51.493 回答