Monday 15 April 2013

php - Using JSONmodel to try and fetch data from a server to ios device -


I am trying to use JSONmodel to get and receive data on my iOS device from my iOS device . I have installed my classes properly but for some reasons this URL is coming to the vacant place after calling. "Http: // http: //www.cs4768project.net76.net/untitled.php Action = getShops":

  feed = [[feed alloc] initFromURLWithString @ completion: ^ (JSONModel * Model, JSONModelError * err) {NSLog (@ "access"); // json received NSLogs (@ "shops:% @", feed .shops);   

Here is the model that holds the feed

  @interface feed: JSONModel @property (strong nonatomic) NSArray * stores; @end   

class my coffee shop

  @interface with the Coffeeshop: JSONModel @property (strong, nonatomic) NSString * name; @protecti (nonatomic) CL LocationDags latitude; @protecti (nonatomic) cl locationgates longitude; Jesaan output:  
  { "name": "Starshans", "latitude": "45", "Lettytud": "- 52"}   

I was trying to find a solution for a while and nothing came and I came to know why this is not working. Any help would be awesome.

OK, it looks like something wrong with JSON because I tried this code < / P>

  NSError * e; NSDictionary * S = [NSJSONSerialization JSONObjectWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @ "http://www.cs4768project.net76.net/untitled.php?action=getShops"]] Options: NSJSONReadingMutableLeaves error: & amp; E]; NSLog (@ "% @", S); If (e) {nslog (@ "% @", e); }   

And it is

  domain = NSCocoaErrorDomain code = 3840 "Operation completed couldnâ ???? t. (Cocoa error 3840k)" (end garbage.) UserInfo = 0x1e0529f0 {NSDebugDescription = end trash.}   

so, if it is your website, I'll change the JSON to a valid format, or the owner Contact the website and inform them about the problem, the answer tells you what the problem is.

No comments:

Post a Comment