I am requesting dynamic json string from web url.
-(void)getDataFromServer{
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.domain.com/json/"]];
[request setHTTPMethod:@"GET"];
[request addValue:@"getValues" forHTTPHeaderField:@"METHOD"];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}
-(void)requestReturnedData:(NSData *)data{ //activated when data is returned
NSDictionary *dictionary = [NSDictionary dictionaryWithJSONData:data];
}
I got below error.
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=0x977a900 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
I have tested with json text file
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.domain.com/jsonfile.json"]];
It works perfectly. How can i overcome this issue.
Edit---
I have found that , if number of rows in json exeeding 200 this error happens. Otherwise it runs perfectly. is there a issue with data size.