2013-10-16 44 views
0

我采用箱IOS-SDK-V2(V1.1.0),当我叫我:断言失败[:inDictionary:hasExpectedType:nullAllowed:NSJSONSerialization ensureObjectForKey]

[[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 = "[email protected]"; 
     name = "John Grigutis"; 
     type = user; 
    }; 
    name = "All Files"; 
    "owned_by" =  { 
     id = 181198661; 
     login = "[email protected]"; 
     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真的不应该为null)或SDK的问题吗?如果这是我的帐户,我该如何解决这个问题?

回答

1

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

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

  • sequence_id
  • ETAG
  • created_at
  • modified_at
  • trashed_at
  • purged_at
  • content_created_at
  • content_modified_at
  • shared_link

我已经把一个补丁,这将抑制这些空值,并将其转换到零。 (我并不想将所有访问器都转换为id返回类型,只是针对根/垃圾文件夹的特殊情况。)https://github.com/box/box-ios-sdk-v2/pull/47

一旦这个提交被合并,我们将会修改一个bug修复版本。

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

+0

在v1.1.1中修复。再次感谢! https://github.com/box/box-ios-sdk-v2/releases/tag/v1.1.1 –

+0

谢谢瑞恩!我看到你也更新了podspec。你是男人! – Jonukas