创建BoxMetadata时出现意外的值

时间:2015-11-05 17:07:18

标签: ios box

我的iOS应用通过BOXContentSDK访问BOX API。突然间,我收到版本'版本的意外类型(int)。和' typeversion'创建BOXMetadata时由于NSJSONSerialization + BOXAdditions.m下面的断言导致崩溃

+ (id)box_ensureObjectForKey:(NSString *)key inDictionary:(NSDictionary *)dictionary hasExpectedType:(Class)cls nullAllowed:(BOOL)nullAllowed
{
    id object = [dictionary objectForKey:key];
    id extractedObject = object;
    if ([object isEqual:[NSNull null]])
    {
        if (nullAllowed)
        {
            extractedObject = [NSNull null];
        }
        else
        {
            BOXAssertFail(@"Unexpected JSON null when extracting key %@ from dictionary %@", key, dictionary);
            extractedObject = nil;
        }
    }
    else if (object == nil)
    {
        extractedObject = nil;
    }
    else if (![object isKindOfClass:cls])
    {
        BOXAssertFail(@"Unexpected type when extracting key %@ from dictionary %@\nExpected type %@ but instead got %@", key, dictionary, NSStringFromClass(cls), NSStringFromClass([object class]));
        extractedObject = nil;
    }
    return extractedObject;
}

以上是我从断言中获得的例外情况;

Expected type NSString but instead got __NSCFNumber'

下面的示例响应JSON;

{"documenttype":"Inspections","categories":"Inspections","reportdocumenttype":"","documentTag":"SR000070022803","csa.internal.only":"false","$type":"properties","$parent":"file_42748776033","$id":"314f1a71-7ecf-4e6f-a765-8a6eaefed6d3","$version":0,"$typeVersion":0,"$template":"properties","$scope":"global"}

谢谢!

1 个答案:

答案 0 :(得分:1)

感谢您与我们联系,Alp。我们的Metadata SDK代码与不再需要值为字符串(在元数据中可以包含整数和浮点值)这一事实不同步。这是您将在https://github.com/box/box-ios-sdk/pull/134中看到的主要更改,其中包含此问题的修复程序。

如果您遇到其他问题,请告诉我们。

祝你好运, 汤姆