【问题标题】:Couchbase iOS:How to convert a CBLDocument to NSDictionary?Couchbase iOS:如何将 CBLDocument 转换为 NSDictionary?
【发布时间】:2014-07-08 01:03:48
【问题描述】:

我要做的是将文档转换为字典,然后迭代该字典以查看其中的内容,但是在尝试转换文档时遇到以下问题。 我有以下代码:

CBLDocument *document = row.value;
NSDictionary *dict = document.properties;

运行到第二条语句时,xCode 总是抱怨“[__NSCFDictionary currentRevision]: unrecognized selector sent to instance 0x90c4150”。 我也试过 NSDictionary *dict = document.currentRevision.properties; 它也不起作用。 谁能帮我解决这个问题?

【问题讨论】:

    标签: ios loops properties document couchbase


    【解决方案1】:

    好吧,原来 row.value 不是一个文档(实际上是一个字典),但是没有人告诉我当我发出时(@[somekey], doc); doc(即值)实际上是字典而不是文档。 但是很奇怪,尽管编译器在将字典分配给 CBLDocument 时没有抱怨。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多