I'm getting a json parse error
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 2.)
Which means there is some problem in jSON response. But I'm facing a weird situation like I'm not getting this error when I'm using the local host url. If I'm using the staging server URL to fetch the json I'm getting this error. But the fact is the same file has been migrated to the staging server.
When I checked url in browser I'm getting same response for both the urls;.
This is my response
[
{
"ClinicId": 15,
"ClinicNumber": "45-001",
"Name": "TBD Utah",
"PCName": "",
"Address": "",
"Address2": "",
"City": "",
"State": "UT ",
"Zipcode": "",
"RegionId": 15,
"Latitude": 0.0,
"Longitude": 0.0,
"MetroId": 0,
"CoopId": 0,
"PublicEmail": "",
"PublicPhoneNumber": "",
"ActualPhoneNumber": "",
"ClinicOpenDate": "0001-01-01T00:00:00",
"ClinicUrl": "",
"Notes": ""
},
{
------
},
{
------
},
]
This is the way i'm fetching the data
NSString *str=@"http://192.2.200.167:84/api/Clinic/ClinicsByLatandLong?latitude=36.778261&longitude=-119.417932&apiKey=E9F5958F-C4BE-4D81-8649-F385205F0684";
NSURL *aUrl = [NSURL URLWithString:str];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:aUrl];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request
delegate:self];
if (connection) {
responseData=[NSMutableData data];
}