0

我收到 twitter v 11 api 响应,我填满了我的数组,但我无法在 tableview 上打印,这是响应

[(Swift.ImplicitlyUnwrappedOptional<Any>.some(<__NSArrayM 0x600000842520>(
{
    contributors = "";
    coordinates = "";
    "created_at" = "Thu Jul 12 11:49:57 +0000 2018";
    entities =     {
        hashtags =         (
        );
        media =         (
                        {
                "display_url" = "pic.twitter.com/IJtq6aLM7K";
                "expanded_url" = "";
                id = 1017375504448479232;
                "id_str" = 1017375504448479232;
                indices =                 (
                    12,
                    35
                );
                "media_url" = "";
                "media_url_https" = "";
                sizes =                 {
                    large =                     {
                        h = 1820;
                        resize = fit;
                        w = 2048;
                    };
                    medium =                     {
                        h = 1067;
                        resize = fit;
                        w = 1200;
                    };
                    small =                     {
                        h = 604;
                        resize = fit;
                        w = 680;
                    };
                    thumb =                     {
                        h = 150;
                        resize = crop;
                        w = 150;
                    };
                };
                type = photo;
                url = "";
            }
        );
        symbols =         (
        );
        urls =         (
        );
        "user_mentions" =         (
        );
    };
    "extended_entities" =     {
        media =         (
                        {
                "display_url" = "pic.twitter.com/IJtq6aLM7K";
                "expanded_url" = "";
                id = 1017375504448479232;
                "id_str" = 1017375504448479232;
                indices =                 (
                    12,
                    35
                );
                "media_url" = "";
                "media_url_https" = "";
                sizes =                 {
                    large =                     {
                        h = 1820;
                        resize = fit;
                        w = 2048;
                    };
                    medium =                     {
                        h = 1067;
                        resize = fit;
                        w = 1200;
                    };
                    small =                     {
                        h = 604;
                        resize = fit;
                        w = 680;
                    };
                    thumb =                     {
                        h = 150;
                        resize = crop;
                        w = 150;
                    };
                };
                type = photo;
                url = "";
            }
        );
    };
    "favorite_count" = 0;
    favorited = 0;
    geo = "";
    id = 1017375507174719488;
    "id_str" = 1017375507174719488;
    "in_reply_to_screen_name" = "";
    "in_reply_to_status_id" = "";
    "in_reply_to_status_id_str" = "";
    "in_reply_to_user_id" = "";
    "in_reply_to_user_id_str" = "";
    "is_quote_status" = 0;
    lang = fr;
    place = "";
    "possibly_sensitive" = 0;
    "retweet_count" = 0;
    retweeted = 0;
    source = "";
    text = "Tweet Tweet";
    truncated = 0;

这是我填写数组的代码

从这段代码中我得到了回应

var timeline = (FHSTwitterEngine.shared().getTimelineForUser(FHSTwitterEngine.shared().authenticatedUsername, isID: true, count: 10), terminator: "")

现在我像这样填满我的数组

 var serviceData : [AnyObject]=[]
 let timelinedata = [timeline] as [AnyObject]
        serviceData = (timelinedata)
        print(serviceData)

我在服务数据中得到了完整的响应,现在我正在尝试在表格视图中的标签上打印,如下所示

let retweerCount = serviceData[indexPath.row]["retweet_count"]
            cell.lblRetweet.text = retweerCount as? String

坚果,我无法打印,谁能给我解决方案

4

1 回答 1

0

我认为retweerCount在下面的代码中integer不那么使用。string

cell.lblRetweet.text = "\(retweerCount as? Int ?? 0)"
于 2018-07-30T06:39:57.023 回答