Getting Array from for loop iterations in Objective-C?

Make your listVehicles a NSMutableArray and do listVehicles addObject:itemDict objectForKey:@"identity" instead of what you are currently doing inside your loop.

Now setting Assets = (null) ... – OmerKhan Jan 6 at 6:33 you haven't done it right. Create an array first and add the object properly. Your new fix (I suppose) NSMutableArray *listVehicles = itemDict objectForKey: @"identity"; isn't what I've told you .

– Bourne Jan 6 at 6:35 no I used this as you told me listVehicles addObject:itemDict objectForKey:@"identity"; – OmerKhan Jan 6 at 6:39 1 listVehicles = NSMutableArray alloc init; outside your loop. And then listVehicles addObject:itemDict objectForKey:@"identity"; inside your loop. – Bourne Jan 6 at 6:40 thanx dude!

@Bourne :) its done .... – OmerKhan Jan 6 at 6:43.

If I'm reading what you're saying correctly I would suggest creating your for loop slightly differently to increase readability and streamline the method. NSDictionary * dict = list objectAtIndex: 0; NSArray * vehicles = dict objectForKey:@"assets"; NSMutableArray * listVehicles = NSMutableArray arrayWithCapacity:vehicles. Count; for (NSDictionary * currentDictionary in vehicles) { NSString * identity = currentDictionary objectForKey:@"identity"; listVehicles addObject:identity; NSLog(@"Added %@ to the array, which is now contains %d objects", identity, listVehicles.

Count); } This is a nice built in feature that keeps you from needing to deal with counts and calling objectForIndexAt: I just quickly typed that up, but I'm pretty sure it does what you're doing. If not though, I still encourage you to tweak it and use that iteration style, I think you'll like it.

Thanx for this information Ryan Crews ... can't accept two answers for 1 question but voting it up.. :) – OmerKhan Jan 6 at 6:44 No worries, the actual answer is the same, just wanted to share the iteration tip = – Ryan Crews Jan 6 at 6:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions