Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end." UserInfo={NSDebugDescription=Garbage at end.}

1.\0 导致JSON无法解析的问题,把\0替换成@""即可。

1     NSString *string = @"{\n\t\"responseType\":\t-1\n}\0";
2     NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
3
4     NSError *error = nil;
5     NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
6
7     NSLog(@"%@, %@", dictionary, error);

输出结果:2016-04-26 11:17:58.460 ******[1635:96721] (null), Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end." UserInfo={NSDebugDescription=Garbage at end.}

时间: 2024-08-02 03:00:37

Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end." UserInfo={NSDebugDescription=Garbage at end.}的相关文章

error = Error Domain=NSCocoaErrorDomain Code=3840

json解析,同样的请求,有一个请求,无反应.纠结了几天,终于解决了. error = Error Domain=NSCocoaErrorDomain Code=3840 "Unescaped control character around character 168." UserInfo={NSDebugDescription=Unescaped control character around character 168.} 报错信息如上: 这个原因,是因为服务器返回的字符串里面

iOS解析JSON字符串报错Error Domain=NSCocoaErrorDomain Code=3840 "Invalid escape sequence around character 586."

将服务器返回的JSON string转化成字典时报错: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid escape sequence around character 586." 仔细查找后在原来解析的基础上将"\"字符替换成""或"\\"后,解析成功.具体的解析代码如下: - (NSDictionary *)parseJsonStringToNSDictionary:(

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"

AF解析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=0x8a8a700 {NSDebugDescription=JSON te

Error Domain=NSCocoaErrorDomain Code=3000 "未找到应用程序的“aps-environment”的授权字符串" UserInfo=0x17426e940 {NS

注册远程通知是报错 Error Domain=NSCocoaErrorDomain Code=3000 "未找到应用程序的"aps-environment"的授权字符串" UserInfo=0x17426e940 {NSLocalizedDescription=未找到应用程序的"aps-environment"的授权字符串} 1. 在X-code中更新证书: Xcode > Preferences > Accounts > pi

CoreData____.sqlite options:(null) ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "T

使用coreData存储数据的时候,运行app就报错CoreData____.sqlite options:(null) ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn't be completed. (Cocoa error 134100.)". 解决办法:把模拟器里面的原来的app删除就可以了.运行OK.

Error Domain=NSCocoaErrorDomain Code=3000 "未找到应用程序的“aps-environment”的权利字符串" UserInfo=0x1bad30 {NSLocalizedDescription=未找到应用程序的“aps-environment”的权利字符串}

Error Domain=NSCocoaErrorDomain Code=3000 "未找到应用程序的“aps-environment”的权利字符串" UserInfo=0x1bad30 {NSLocalizedDescription=未找到应用程序的“aps-environment”的权利字符串} code =3000 App ID 和 Bundle Identity不匹配.

AVAudioplayer时error解决 创建失败 ERror creating player: Error Domain=NSOSStatusErrorDomain Code=2003334207 "(null)"

AVAudioplayer 有两个初始化方法: 1.[[AVAudioPlayer alloc] initWithData:musicData error&e]; 2.[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&error]; 第一种是使用将音频文件的data文件初始化,但是data必须是一个完整的文件. 第二种是从url获取,但是这里的url是本地的file URL. 所以AVAudioplayer无法直接从网络

Error Domain=ASIHTTPRequestErrorDomain Code=8 "Failed to move file from"xxx/xxx"to"xxx/xxx"

今天真的好高兴呀 我解决了一个折磨了我一周的问题,真的是激动地要哭出来了,为了这个问题,我嘴也烂了,头发抓了一地啊.虽然解决方法,最后还是展现出了“百度”的伟大,但是我还是很开心,在这里我展示一下我的战果 问题的表面就是在2G下下载zip包失败,不是每次都失败,而是只要我离开当前页面再次进入当前页面就会失败(进入requestFail),如果只是离开不进入,那么一起正常. 多么诡异呀,起初我也想通过看看进入页面后是不是进行了什么卑鄙的操作,而导致ASI罢工,可是最后我放弃了,因为任何有关ASI的

Error Domain=NSURLErrorDomain Code=-999错误

有时候遇到这个错误:Error Domain=NSURLErrorDomain Code=-999 "The operation couldn't be completed. 这里有一个解释:王正东博客 | Error Domain=NSURLErrorDomain Code=-999 "The operation couldn't be completed. - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSEr