美文网首页
iOS json 3840

iOS json 3840

作者: 问问问你 | 来源:发表于2018-06-07 13:58 被阅读16次

解析服务器json数据错误
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x9152780 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
结局代码如下

NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:keyValues
                                                    options:NSJSONReadingAllowFragments
                                                      error:&err];
if(err)
{
    NSLog(@"json解析失败:%@",err);
    return nil;
}

相关文章

网友评论

      本文标题:iOS json 3840

      本文链接:https://www.haomeiwen.com/subject/rjlgsftx.html