Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Error when trying to parse stream data #11

lukef opened this Issue Feb 9, 2011 · 1 comment


None yet
3 participants

lukef commented Feb 9, 2011

Whenever I try to parse a stream of data using ASIHTTPRequest I get the following error:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil value at objects[0](key: NSLocalizedDescription)'

The method that fails is 'yajl_lex_lex'. It looks like the code is showing an invalid char no matter what get's fed in.

The code I used is simple:
YAJLDocument *jsonDoc = [[[YAJLDocument alloc] init] retain]; // defined globally

  • (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data {
    NSError *error = nil;
    YAJLParserStatus status = [jsonDoc parse:data error:&error];

No matter what JSON data I try, same error. If I parse on completion, the data parses fine.

In case you're still having this problem: are your responses gzip compressed? If so, you need to set the following:

[request shouldWaitToInflateCompressedResponses:NO]

By default, responses are not inflated on the fly. See this portion of the ASIHTTPRequest documentation: http://allseeing-i.com/ASIHTTPRequest/How-to-use#on-the-fly_inflating

@gabriel gabriel closed this Apr 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment