繁体   English   中英

如何在iPhone中实现Facebook集成的社交框架? [关闭]

[英]How to implement social framework for Facebook integration in iphone? [closed]

我在一个项目中工作,需要在Facebook上获取朋友的人名单。 为此,我需要在项目中实施社交框架 当我寻找该框架时,我会在所有站点上获得共享工具包。 获取共享工具包。 你能告诉我从哪里可以得到那个社会框架。 如果可能的话,请提供一个示例代码来实现上述的概念。

任何帮助将不胜感激

对于Facebook,您可以使用官方的facebook-ios-sdk (任何版本,但Facebook可以发布3.0beta版-比2.0版更易于理解和灵活)

这里的教程

在那之后,阅读样本和其他内容是一件好事。

而且您需要从github下载sdk -也很简单。

为了在您的项目中实现Facebook,请使用最新的FBGraph方法,这是Facebook的最新方法。 您将必须首先导入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);    

}

}

首先,您只需使用您的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上共享您的文本和图像;-)我认为这对您有帮助

与IOS 6集成在一起的接口允许您以不像导入邮件接口一样的方式发布到FB,而无需导入任何外部框架。有关更多信息,请访问: http : //developer.apple.com/library/ios /#documentation/Social/Reference/Social_Framework/_index.html#//apple_ref/doc/uid/TP40012233

社交框架实际上是在NDA之下的,因此,如果您不是注册开发人员,那么您将无法获得。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM