0

我正在使用 box-ios-sdk-v2 (v1.1.0),当我打电话时:

[[BoxCocoaSDK sharedSDK].foldersManager folderInfoWithID:BoxAPIFolderIDRoot
                                          requestBuilder:nil
                                                 success:folderSuccess
                                                 failure:failure];

我得到一个断言失败:

*** Assertion failure in +[NSJSONSerialization ensureObjectForKey:inDictionary:hasExpectedType:nullAllowed:], ~/MyApp/Pods/box-ios-sdk-v2/BoxSDK/Categories/NSJSONSerialization+BoxAdditions.m:27
An uncaught exception was raised
+[NSJSONSerialization(BoxAdditions) ensureObjectForKey:inDictionary:hasExpectedType:nullAllowed:]: Unexpected JSON null when extracting key modified_at from dictionary {
    "content_created_at" = "<null>";
    "content_modified_at" = "<null>";
    "created_at" = "<null>";
    "created_by" =     {
        id = "";
        login = "";
        name = "";
        type = user;
    };
    description = "";
    etag = "<null>";
    "folder_upload_email" = "<null>";
    id = 0;
    "item_collection" =     {
        entries =         (
                        {
                etag = 0;
                id = 1092326452;
                name = CSS;
                "sequence_id" = 0;
                type = folder;
            },
                        {
                etag = 1;
                id = 680411078;
                name = New;
                "sequence_id" = 1;
                type = folder;
            },
                        {
                etag = 2;
                id = 8224096128;
                name = ".apdisk";
                "sequence_id" = 2;
                sha1 = e8389b6e4307a798b0811cabc94144ce381b3312;
                type = file;
            }
        );
        limit = 100;
        offset = 0;
        order =         (
                        {
                by = type;
                direction = ASC;
            },
                        {
                by = name;
                direction = ASC;
            }
        );
        "total_count" = 3;
    };
    "item_status" = active;
    "modified_at" = "<null>";
    "modified_by" =     {
        id = 181198661;
        login = "grigutis@iu.edu";
        name = "John Grigutis";
        type = user;
    };
    name = "All Files";
    "owned_by" =     {
        id = 181198661;
        login = "grigutis@iu.edu";
        name = "John Grigutis";
        type = user;
    };
    parent = "<null>";
    "path_collection" =     {
        entries =         (
        );
        "total_count" = 0;
    };
    "purged_at" = "<null>";
    "sequence_id" = "<null>";
    "shared_link" = "<null>";
    size = 289;
    "trashed_at" = "<null>";
    type = folder;
}

这是我的帐户(modified_at 真的不应该为空)还是 SDK 的问题?如果是我的帐户,我将如何解决?

4

1 回答 1

1

我是 Box iOS SDK 的维护者。感谢您的错误报告!根文件夹是 Box 上的特殊文件夹。根文件夹是实际不存在的“虚拟文件夹”(这解释了为什么它们在所有用户帐户中的 id 始终为 0)。因为根文件夹(和垃圾文件夹)是虚拟文件夹,所以我们不跟踪它们的一些元数据,例如 modified_at 时间戳。

根/垃圾文件夹可能为空的字段列表:

  • 序列号
  • 电子标签
  • created_at
  • 修改后的_at
  • 垃圾邮件
  • 清除_at
  • content_created_at
  • content_modified_at
  • 共享链接
  • 父母

我已经整理了一个补丁,可以抑制这些 Null 并将它们转换为 nil。(我不想仅仅为了根/垃圾文件夹的特殊情况将所有访问器都转换为 id 返回类型。)https://github.com/box/box-ios-sdk-v2/pull/47

合并此提交后,我们将删除错误修复版本。

我们应该记录这种边缘情况/特殊情况的行为。我会让我们的文档团队知道。

于 2013-10-24T06:50:22.327 回答