2013-10-16 16 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