如何在iPhone中通过查询解析相似计数值

发布于 2024-11-16 21:28:30 字数 1069 浏览 2 评论 0原文

我正在使用 FQL。这是我的代码,它从流表获取消息。

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

我得到如下结果。

{
    "actor_id" = 100002464401210;
    likes =         {
        "can_like" = 1;
        count = 2;
        friends =  (
            {
                uid = 10000215363608;
            }
        );
        href = "http://www.facebook.com/browse/?type=likes&id=106536123438461";
        sample =             (
        );
        "user_likes" = 1;
    };
    message = "hello wall testing..";
},
    {
    "actor_id" = 10000223601210;
    likes =         {
        "can_like" = 1;
        count = 0;
        friends =             (
        );
        href = "http://www.facebook.com/browse/?type=likes&id=108123469280566";
        sample =             (
        );
        "user_likes" = 0;
    };
    message = "New integration";
},

我想对我的查询进行排序,就像最喜欢的帖子将位于顶部一样。 我将如何修改我的查询以在顶部显示最喜欢的内容。

提前致谢

I am using FQL. And here is my code which is fethcing message from stream table.

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

And I am getting result like below.

{
    "actor_id" = 100002464401210;
    likes =         {
        "can_like" = 1;
        count = 2;
        friends =  (
            {
                uid = 10000215363608;
            }
        );
        href = "http://www.facebook.com/browse/?type=likes&id=106536123438461";
        sample =             (
        );
        "user_likes" = 1;
    };
    message = "hello wall testing..";
},
    {
    "actor_id" = 10000223601210;
    likes =         {
        "can_like" = 1;
        count = 0;
        friends =             (
        );
        href = "http://www.facebook.com/browse/?type=likes&id=108123469280566";
        sample =             (
        );
        "user_likes" = 0;
    };
    message = "New integration";
},

I want to sort my query like most liked post will be on top.
How will I modify my query to show most liked on top.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新一帅帅 2024-11-23 21:28:30

您已将响应格式指定为 JSON 。这就是您收到 JSON 格式的响应的原因。

请参阅下面的博客文章来解析您的回复。

教程:iPhone 上的 JSON Over HTTP

iPhone JSON Flickr 教程 – 第 1 部分

You have specified the response format as JSON .That' why you are getting response in JSON format.

See below blog post to parse you response.

Tutorial: JSON Over HTTP On The iPhone

iPhone JSON Flickr Tutorial – Part 1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文