FQL ステートメントを使用して、ユーザーの名前、pic_square、およびステータス オブジェクトを取得しようとしています。
Graph API Explorer を使用するとうまく機能します。結果は次のとおりです。
{
"data": [
{
"uid": 657asdf,
"name": "Name1",
"pic_square": "http://profile.ak.fbcdn.net/hprofile-ak-snc7/371062_657477736_1asd.jpg",
"status": {
"message": "who want's to bring me a burrito?",
"time": 1349381334,
"status_id": "1015110984sadf",
"comment_count": 0
}
},
{
"uid": 123asdf,
"name": "name2",
"pic_square": "http://profile.ak.fbcdn.net/hprofile-ak-snc6/275748_607345433_91234.jpg",
"status": {
"message": "my excitement for tonight on a scale of 1-10 just went from a 15 to a 3 pretty quick",
"time": 1349386828,
"status_id": "1015216195asdf",
"comment_count": 0
}
},
しかし、Xcode では次の結果が得られます。ステータスが であることに注意して<null>
ください。
data = (
{
name = "Name1";
"pic_square" = "http://profile.ak.fbcdn.net/hprofile-ak-ash4/371941_803145_672321642_q.jpg";
status = "<null>";
uid = 801asdf;
},
{
name = "Name2";
"pic_square" = "http://profile.ak.fbcdn.net/hprofile-ak-ash4/276004_2403715_8811asdf.jpg";
status = "<null>";
uid = 240asdf;
},
ここから移植したコードは次のとおりです。
NSString *query =
@"SELECT uid, name, pic_square, status FROM user WHERE (uid IN "
@"(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 1055)) ORDER BY status.time";
NSDictionary *queryParam =
[NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
// 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 {
NSLog(@"Result: %@", result);
}
}];
これは、IOS Facebook API FBRequestConnection メソッドの制限ですか? 代替アプローチはありますか?1 つの FQL クエリでユーザー名とステータスの両方を取得しようとしているのは私だけではないと確信しています。