我正在做一个项目,在这个项目中,我需要在Facebook上得到朋友的名单。为此,我需要在我的项目中实现社会框架。当我寻找这个框架时,我会在所有网站上获得共享工具包。去拿分享包。,你能告诉我从哪里可以得到那个社会框架吗?如果可能的话,请提供一个示例代码,用于实现我提到的上述概念。
如有任何帮助,将不胜感激。
发布于 2012-07-28 05:49:20
要在项目中实现Facebook,请使用来自Facebook的最新FBGraph方法。您必须首先导入FBGraph和JSON解析器。然后在要添加shareview的类中添加以下方法:)
这里有一些代码可以帮你,
-(void)buttonActionFb
{
//postFeedButton.hidden=NO;
NSString *client_id = @"130902823636657";
self.fbGraph =[[FbGraph alloc] initWithFbClientID:client_id];
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
}
- (void)fbGraphCallback:(id)sender
{
if ((fbGraph.accessToken==nil)||([fbGraph.accessToken length]==0)) {
// NSLog(@"You pressed the 'cancel' or 'Dont Allow' button, you are NOT logged into Facebook...");
//resart authentication process...
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"]; }
else
{
UIAlertView *alertfB=[[UIAlertView alloc] initWithTitle:@"Note" message:nil
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertfB show];
// NSLog(@"LOG IN FACEBBOK %@",fbGraph.accessToken);
}
}
发布于 2012-07-28 06:19:44
对于Facebook来说,你可以使用官方的facebook-ios-sdk (任何版本,但是facebook使3.0beta版本比2.0更容易理解和灵活)
这里为您提供教程
在那之后,阅读样本和其他东西是很好的。
你需要从github下载sdk。-这也很简单。
发布于 2012-12-13 07:52:18
首先,您只需使用您的Facebook/twitter帐户登录,然后单击按钮(您希望在Facebook或twitter上共享数据)并编写以下代码
NSArray *activityItems;
activityItems = @[@"Text Here",self.imgview.image];
UIActivityViewController *activityController =
[[UIActivityViewController alloc]
initWithActivityItems:activityItems
applicationActivities:nil];
[self presentViewController:activityController
animated:YES completion:nil];
imgview是UIimageView的插座,它只是在Facebook/Twitter上分享你的文本和图片;-)我认为这是帮助你
https://stackoverflow.com/questions/11698619
复制相似问题