如何在iOS 5中整合Facebook?
答
社会框架。 有使用它的代码。添加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];
}
}
你检查https://developers.facebook.com/ios/ – vqdave 2013-02-14 20:06:14
可以使用Sharekit或使用Facebook IOS SDK .. – lakesh 2013-02-15 02:19:01