0

我有一个数组(结果),它在控制台上显示这样的输出。我将结果作为 facebook 多查询输出。这是结果的定义。

-(void)request:(FBRequest*)request didLoad:(id)result {

NSLog(@" 结果为 %@",result);

}

我的多查询格式在这里。

NSString* fql1 = [NSString stringWithFormat:@"select uid,username,name from user where uid == %lld", _session.uid];

NSString* fql2 = [NSString stringWithFormat:@"SELECT likes,message FROM stream WHERE source_id = %lld limit 50", _session.uid];

NSString* 查询 = [NSString stringWithFormat:@"{\"UserRecord\":\"%@\",\"WallData\":\"%@\"}",fql1,fql2];

NSDictionary* params = [NSDictionary dictionaryWithObject:queries forKey:@"queries"];

[[FBRequest requestWithDelegate:self] call:@"facebook.fql.multiquery" params:params];

result is (

{

"fql_result_set" =  (

                {

        name = "My Login Name";

        uid = 1000024646062353;

        username = myuserid;

    }

);

name = UserRecord;

},

{

"fql_result_set" =   (

                {

        likes =  {

            "can_like" = 1;

            count = 2;

            friends =  (

                         {
                    uid = 100002483363608;

                }

            );

  href = "http://www.facebook.com/browse/?type=likes&id=108202343353";

 sample =  (

            );
            "user_likes" = 1;

        };

        message = "This wall post is not from application.";
  },


);

name = WallData;

}

)

我想获取另一个仅保留“消息”值和另一个将保留“计数”值的消息。我将如何将这些值与上述数组输出分开

4

1 回答 1

1

编辑版本:

NSString *messageString = [[[[result objectAtIndex:1]objectForKey:@"fql_result_set" ] objectAtIndex:0] objectForKey:@"message"];
NSnumber *countNumber = [[[[[result objectAtIndex:1]objectForKey:@"fql_result_set" ] objectAtIndex:0] objectForKey:@"likes"] objectForKey:@"count"];
于 2011-07-07T07:50:05.190 回答