I am having a problem storing JSON data into an Array of individual objects. It seems like the problem is in the execution of dispatch_asynch which is handling the JSON request. WHen I create a breakpoint before the method and than step through the application it seems to just fall through the block sent into dispatch_async.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(queue, ^{ NSError *error = nil; NSURL *url = [NSURL URLWithString:@"http://sleepy-dusk-3603.herokuapp.com/companies.json"]; NSString *json = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error]; NSLog(@"\nJSON: %@ \n Error: %@", json, error); if(!error) { NSData *jsonData = [json dataUsingEncoding:NSASCIIStringEncoding]; NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:&error]; NSArray *tempArray = [NSArray arrayWithObjects:@"Call Support Desk", @"Call Genius Bar", nil]; for (NSString *name in [jsonDict valueForKeyPath:@"name"]) { NSString *tempString = [[NSString alloc] initWithString:name]; Company *company = [[Company alloc] initWithName:tempString available_actions:tempArray]; [self addCompany:company]; I truly appreciate everyone's help and support with this issue.
dispatch_asynccall?if (json != nil), notif (!error). Also why are you usingNSASCIIStringEncoding? Are you sure it's not UTF-8?