2

我想使用Facebook Api获取Facebook好友列表。因此,我在Facebook上创建了新应用,并获得了AppID,并在我的原生iOS应用中使用该AppID和Bundle ID时提供Bundle ID,并使用api获取所有朋友列表以获取空朋友列表。使用我的FacebookAppID在iOS中无法使用

如果我使用"SendRequestHowTo"示例项目的应用程序ID,它将获得登录用户的所有朋友列表。告诉我如何在Facebook开发人员站点上配置我的新应用程序以获取好友列表。

我对获得好友列表代码:

// Query to fetch the active user's friends, limit to 25. 
    NSString *query = 
    @"SELECT uid, name, pic_square FROM user WHERE uid IN " 
    @"(SELECT uid2 FROM friend WHERE uid1 = me())"; 
    // Set up the query parameter 
    NSDictionary *queryParam = @{ @"q": query }; 
    // Make the API request that uses FQL 
    [FBRequestConnection startWithGraphPath:@"/fql" 
           parameters:queryParam 
           HTTPMethod:@"GET" 
          completionHandler:^(FBRequestConnection *connection, 
               id result, 
               NSError *error) { 
           if (error) { 
            NSLog(@"Error: %@", [error localizedDescription]); 
           } else { 
            _friends_list = (NSArray *) result[@"data"]; 
            NSLog(@"Result: %@", result); 

            [self getLetsWalkeeFriendList]; 

            // Sort Table Data 
            [self sortTableView]; 
//         [_tbl_view_friends reloadData]; 
           } 
           [self.view setUserInteractionEnabled:YES]; 
//        [self.view hideToastActivity]; 
          }]; 

使用示例项目的AppID(即FacebookAppID:403223126407920和捆绑IDENTIFER:com.facebook.samples.SendRequestsHowTo)。当我与Facebook登录我输出

Result: { 
    data =  (
       { 
      name = "Assad Sarwar"; 
      "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c153.5.545.545/s50x50/1978738_766566543368250_230425531_n.jpg"; 
      uid = 100000447351759; 
     }, 
       { 
      name = "Muhammad Hassan Butt"; 
      "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/t1.0-1/c0.0.50.50/p50x50/10167970_873047696055100_7845811348955741805_n.jpg"; 
      uid = 100000496339789; 
     }, 
       { 
      name = "Umair Jafar"; 
      "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/t1.0-1/c0.2.50.50/p50x50/10500337_910092152350902_4827832642500691993_n.jpg"; 
      uid = 100000503784242; 
     }, ......... 
) 
} 

,当我用我的AppID这是由Facebook和使用相同的用户进行登录到Facebook的规定,我得到了像

Result: { 
      data =  () 
    } 
+0

去developer.facebook.com – NullData

回答

1

输出之后创建的应用程序2014年4月30日,端点/me/friends将仅返回也会使用您的应用的朋友列表。请参阅平台升级指南[1]。

[1] https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

+2

我知道如何使用Facebook API,但它给我的朋友列表时,我使用[示例项目](https://github.com/fbsamples/ios-3.5-howtos/tree/master/SendRequestsHowTo)AppID(即FacebookAppID:403223126407920和Bundle identifer:com.facebook.samples.SendRequestsHowTo)。当我在developer.facebook.com AppID和Bundle标识符上使用我创建的应用程序时,它没有给出我对朋友列表的回复。请给我解决这个问题来使用我的AppID和Bundle Identifier。提前致谢。 –

+0

我的回答是基于您提供的少量信息。添加相关的代码示例,错误消息和日志输出,我很乐意帮助 –

+2

我编辑我的问题你可以检查这个并给我解决方案。谢谢 –

0

的Facebook改变他们的访问朋友名单权限。所以你需要请求的权限,请访问此链接,并要求许可: - https://developers.facebook.com/docs/ios/creating-ios-simulator-build-for-review

+2

所以,你可以告诉我,我必须为Facebook审查模拟器构建后,我得到了许可? –

+0

转到您的Facebook开发者帐户选择您的应用程序。然后进入状态和审查,然后添加项目在此提交在这里你可以看到所有的Facebook权限选择你需要的然后填写所有信息并提交它 – Hardik

+0

是的,你需要给模拟器构建然后Facebook给你的权限。 – Hardik

相关问题