3

到目前为止,OS X 10.8.2 的Social.Framework运行良好:

NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/me/friends"];
SLRequest *fbRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:requestURL parameters:params];

这正确地传递了me()对象的朋友列表。美好的!

但是,一旦我尝试使用Field Expansion,如下所示,请求失败并出现错误: 必须使用活动访问令牌来查询有关当前用户的信息

[NSURL URLWithString:@".../friends?fields=cover,picture"];

这肯定是因为 access_token 将使用 st 附加到 Social.framework 内部。类似于 "?access_token=%@",它会与我之前的?fields=使用一起失败。

所以我想知道这实际上是框架的一个错误,还是我使用错误?我真的很感谢任何有用的信息。

4

1 回答 1

5

直接联系 Apple 后,答案显然是这样的:使用 GET 参数变量添加字段扩展标签,而不是添加到实际 URL:

SLRequest *fbRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:requestURL
parameters:@{@"fields":@"cover,picture"}];

这很明显,但我没有想到:)。如果将来有人可能偶然发现同样的问题,我会让这个线程保持原样!

于 2013-01-31T15:22:27.330 回答