Reputation: 1065
I guess I'm not clear enough with the title, so here it goes:
I'm building an application that has a facebook login, but I use the SBJSON parser that the Facebook API has in it to parse other documents. Now the problem that I have is strange for me. The parser is not getting the updates that I make in the JSON that it reads.
I use this content:
{
"categories": [
{
"id": 5,
"catunique": "f874f7d2b48b099400e9f22ea512c234c4f89d81",
"cattitle": "Nature",
"catfold": "nature"
},
{
"id": 3,
"catunique": "edfbb81a83e37b045bfddec1c4fbbbef52b408e7",
"cattitle": "Bikes",
"catfold": "bikes"
}
],
"images": [
{
"id": 31,
"catunique": 5,
"imgtag": "Pig",
"imgname": "pig759.png",
"imgbname": "[email protected]"
},
{
"id": 32,
"catunique": 5,
"imgtag": "Frog Shadow",
"imgname": "frogshadow503.jpg",
"imgbname": "[email protected]"
},
{
"id": 33,
"catunique": 3,
"imgtag": "Cat",
"imgname": "cat518.jpg",
"imgbname": "[email protected]"
}
]
}
This is parsed OK but if I add another item in the "images" object I re-run the application and the response is not getting it.
in my App Delegate I have this code for using the parser
SBJSON *json = [[SBJSON alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://somedomain.com/images.json"]];
//[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
//[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyNever];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
//set data to string with encoding
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
imagesJsonData = [json objectWithString:json_string error:nil];
Can someone tell me if this is a server problem, Parser problem or my coding problem
Upvotes: 1
Views: 115
Reputation: 2632
First off: you're using a really ancient version of SBJson. I recommend you use a more recent version. Second: are you sure your server is actually sending the new data file? Try looking at it in Safari / Firefox / Chrome. If the extra data is there, check if NSURLConnection is somehow caching your request. (Maybe append a random ?r=1234123
to the URI?)
Upvotes: 2