首页 > 解决方案 > 无法在表格视图中打印 Google+ 响应

问题描述

我收到 Google+ 回复,但我不明白如何在 Swift 中打印数组 ito 对象的回复,这是我的回复

回复

{
    access={
      description=Public;items=({
        type=public;
      });
      kind="plus#acl";
    };
    actor={
      displayName="David Cortex";
    id=109312437164671299520;
    image={
        url="https://lh4.googleusercontent.com/-ThgEmnPFYYk/AAAAAAAAAAI/AAAAAAAAACQ/WPsSVrwV2QU/photo.jpg?sz=50";
      };
      url="https://plus.google.com/109312437164671299520";
      verification={
        adHocVerified="UNKNOWN_VERIFICATION_STATUS";
      };
    };
    etag="\"jb1Xzanox6i8Zyse4DcYD8sZqy0/xVZBlUo9r9epJ_89TXvxLKINDpQ\"";
    id=z12wxpaqqu2rhrse523wthozexffxnhke;
    kind="plus#activity";


    object={   **i want to print attachments data like image reshares and replies but not able to understand how to do that**
      actor={
        verification={
          adHocVerified="UNKNOWN_VERIFICATION_STATUS";
        };
      };

      attachments=({
        content="gplus-2128611415.jpg";
        displayName="Test Post";
        fullImage={
          height=480;
          type="image/jpeg";
          url="https://lh3.googleusercontent.com/-CPumbzy2aCw/W2gUJhHp8eI/AAAAAAAAALk/nHPiSw2M8vkCSMbcsH9Mjq26ZLhQYrGggCJoC/w480-h480/gplus-2128611415.jpg";
          width=480;
        };
        id="109312437164671299520.6586536608771207650";
        image={
          type="image/jpeg";
          url="https://lh3.googleusercontent.com/-CPumbzy2aCw/W2gUJhHp8eI/AAAAAAAAALk/nHPiSw2M8vkCSMbcsH9Mjq26ZLhQYrGggCJoC/w506-h750/gplus-2128611415.jpg";
        };
        objectType=photo;url="https://plus.google.com/photos/109312437164671299520/albums/6586536610238804449/6586536608771207650";
      });
      content="Test Post";
      objectType=note;plusoners={
        selfLink="https://www.googleapis.com/plus/v1/activities/z12wxpaqqu2rhrse523wthozexffxnhke/people/plusoners";
        totalItems=0;
      };
      replies={
        selfLink="https://www.googleapis.com/plus/v1/activities/z12wxpaqqu2rhrse523wthozexffxnhke/comments";
        totalItems=0;
      };
      resharers={
        selfLink="https://www.googleapis.com/plus/v1/activities/z12wxpaqqu2rhrse523wthozexffxnhke/people/resharers";
        totalItems=0;
      };
      url="https://plus.google.com/109312437164671299520/posts/CfnxAnsjzxp";
    };
    provider={
      title="Google+";
    };
    published="2018-08-06T09:25:58.775Z";
    title="Test Post";updated="2018-08-06T09:25:58.775Z";
    url="https://plus.google.com/109312437164671299520/posts/CfnxAnsjzxp";
    verb=post;
  }

现在在这里我展示我尝试过的代码

代码

   func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! GooglePostListTableViewCell
        let instaResponse = serviceData[indexPath.row]["actor"] as! [String:Any]
        let fName = instaResponse["displayName"] as! String
        cell.lblUserName.text = fName

        let object = serviceData[indexPath.row]["object"] as! [String : Any]
        let content = object["content"] as! String
        cell.lblPostDesc2.text = content
//        let object = serviceData[indexPath.row]["attachments"] as! [String:Any]
//        let content = object["content"] as! String
//        cell.lblPostDesc2.text = content
        let gplus = serviceData[indexPath.row]["object"] as! [String:Any]
        let plusoners = gplus["attachments"]!["plusoners"] as! String
        cell.lbl2.text = plusoners
        return cell
    }

所以我的意思是我想在数据中打印对象和附件的数据,所以请任何人帮我解决这个问题。

所以我的意思是说如何在对象中的数据中打印附件,所以请帮忙。

标签: iosswiftuitableviewgidsignin

解决方案


推荐阅读