Facebook集成在ios应用程序中

时间:2012-08-11 06:34:28

标签: iphone facebook

如何在iOS应用程序中集成facebook?

我曾尝试过一次,但我不明白如何从开发者帐户生成密钥

如果可能,那么请向我提供一份详细描述所有内容的文件

提前致谢。

1 个答案:

答案 0 :(得分:0)

您可以使用FBGraph方法集成facebook。在这里,您必须首先导入JSON和FBGraph框架。之后写下面的代码: -

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)) {

    [fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];            }    
else
{
    NSMutableDictionary *Variables=[[NSMutableDictionary alloc] initWithCapacity:2];
    FbGraphFile *graph_File=[[FbGraphFile alloc] initWithImage:imageCollage.image];
    [Variables setObject:graph_File forKey:@"file"];
    [Variables setObject:@"" forKey:@"message"];
相关问题