简体   繁体   English

如何使用iPhone中的REST API在FBConnect中授予扩展权限

[英]How to give extended permissions in FBConnect with REST API in iPhone

I have developed an iPhone application, which is communicating data with faceBook. 我已经开发了一个iPhone应用程序,该应用程序正在与faceBook进行数据通信。 Initially I was only able to get basic information of user from Facebook. 最初我只能从Facebook获得用户的基本信息。 To post to a user's wall, I learnt about giving extended permission 'publish_stream', hence I added following code snippet: 为了发布到用户的墙上,我了解了如何授予扩展权限“ publish_stream”,因此添加了以下代码片段:

- (void)session:(FBSession*)session didLogin:(FBUID)uid {

   FBPermissionDialog* dialog = [[[FBPermissionDialog alloc] init] autorelease];
   dialog.delegate = self;
   dialog.permission = @"status_update";
   [dialog show]; 

   [self getFacebookName];
} 

And made necessary changes in the FBPermissiondialog class file. 并在FBPermissiondialog类文件中进行了必要的更改。

Now this is allowing me to post to my wall, but it shows two separate dialogs for permissions, first to access user's basic information, and second for publishing permission. 现在,这使我可以张贴到墙上,但是它显示了两个单独的权限对话框,第一个用于访问用户的基本信息,第二个用于发布权限。 I want to have all permissions in a single pop-up. 我想在一个弹出窗口中拥有所有权限。 Also, I am using FBRequest to post to Facebook, not FBStreamDialog (as I dont want the UI for posting). 另外,我使用FBRequest发布到Facebook,而不是FBStreamDialog(因为我不希望发布UI)。

Please help me with this, I badly need to resolve this issue soon. 请对此提供帮助,我非常需要尽快解决此问题。 Thanks in advance. 提前致谢。

In FBLoginDialog.m file 在FBLoginDialog.m文件中

- (void)loadLoginPage {

    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
    @"1", @"fbconnect", @"touch", @"connect_display", _session.apiKey, @"api_key",
    @"fbconnect://success", @"next",@"user_photos,photo_upload",@"req_perms",nil];

    [self loadURL:kLoginURL method:@"GET" get:params post:nil];

}

add "req_perms" key to the dictionary as shown above. 如上所述,将“ req_perms”键添加到字典中。

Hope this will solve your problem :) 希望这能解决您的问题:)

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

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