Thursday, 15 March 2012

ios - Json Accelerator and AFNetworking -


After

When the operation is in progress, I can not access the data created by the JSON model ACCELERATOR. Can you tell me what I am doing?

  {[super viewDidLoad]; NSLog (@ "You are in a Table View Controller"); Self.title = @ "Navigationordini"; NSURLRequest * Request = [NSURLRequest requestWithURL: [NSURL URLWithString: @ "http://www.stampa6x3.com/json.php?azione=ordini"]]; AFJSONRequestOperation * Operations; Operation = [AFJSONRequestOperation JSONRequestOperationWithRequest: Request Success: ^ (NSURLRequest * Request, NSURLResponse * Feedback, ID JSON) [[[ordiniModel alloc] initWithDictionary: JSON]; } Failure: ^ (NSURLRequest * request, NSURLResponse * response, NSError * error, ID JSON) {[self setTitle: @ "dictionary"]; NSLog (@ "Failed!% D", [Error Code]); }]; [Start operation]; OrdiniModel * testing; NSLog (@ "el vulor è% @", test.ordini.description); } Text after " 

AFJSONRequestOperation is asynchronous, which means that while the rest of the code is executed Continues for the app runs the complete block is complete when the code actually completes.

Then try:

  NSLog (@ "You are in a Table View Controller"); Self.title = @ "Navigationordini"; Audienymold * Examination; // & lt; - Create variables here NSURLRequest * Request = [NSURLRequest requestWithURL: [NSURL URLWithString: @ "http://www.stampa6x3.com/json.php?azione=ordini"]]; AFJSONRequestOperation * Operations; Operation = [AFJSONRequestOperation JSONRequestOperationWithRequest: Request success: ^ (NSURLRequest * request, NSURLResponse * response, ID JSON) {test = [[ordiniModel alloc] initWithDictionary: JSON]; // & lt; - Assign NSLog (@ "IL Velor è% @", test.ordini.description); } Failure: ^ (NSURLRequest * request, NSURLResponse * response, NSError * error, ID JSON) {[self setTitle: @ "dictionary"]; NSLog (@ "Failed!% D", [Error Code]); }]; [Start operation];    

No comments:

Post a Comment