报错
**Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected end of file during string parse (expected low-surrogate code point but did not find one)." UserInfo={NSDebugDescription=Unexpected end of file during string parse (expected low-surrogate code point but did not find one).}**
解决方案
利用JSONKit 地址https://github.com/johnezang/JSONKit
解析时添加的代码
return [self.netManager GET:url parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSError *error;
id information = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:&error];
DLog(@"解析错误信息==============%@",error);
//关键代码
if (error) {
error = nil;
id information = [responseObject objectFromJSONDataWithParseOptions:JKParseOptionLooseUnicode error:&error];
!success?:success(information);
}
//end
!success?:success(information);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if (failure) {
failure(error);
}
}];
网友评论