解析服务器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;
}
网友评论