views:

14

answers:

0

I am using following lines of code to convert the data (NSData) to NSString. I am getting nil value from string. But I get around 640 bytes from the server. The problem occurs only when we convert data to NSString. I used NSASCIIStringEncoding, NSUTF8StringEncoding, NSUnicodeStringEncoding for encoding parameter. Can someone shed light on the problem?

NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];



NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];