If I have an NSMutableArray where I added objects of different classes (e.g. NSString, NSMutableString, NSProcessInfo, NSURL, NSMutableDictionary etc.) Now I want to fast enumerate this array, so I tried:
for (id *element in mutableArray){
   NSLog (@"Class Name: %@", [element class]);
   //do something else
}
I am getting a warning i...
            
           
          
            
            Just wondering, it seems like it works pretty well but I want to make sure I am using generally accepted coding practices and not get into bad habits.
Thanks,
Nick
...
            
           
          
            
            after much debugging, I have determined that this code is ignoring the fast enumeration loop and blindly jumping to the end:
-(void)loadOutAnnotations
{
    NSLog(@"entering Annotation enumeration Loop");
    iProspectFresno_LiteAppDelegate *appDelegate =(iProspectFresno_LiteAppDelegate *)[[UIApplication sharedApplication] delegate];
...
            
           
          
            
            Hello,
I have my data in a NSDictionary object where the keys are CGPoints converted to NSValues and the objects are UIColors. Here's the method I'm using to return an object from the dictionary:
- (UIColor*) getTemperatureColor2 {
    NSDictionary* temperatureColorMap = [Weather getTemperatureColorMap];   
    for(id key in temperatu...
            
           
          
            
            Can I expect it to go from the start of an array to the end in order? Can't find anything in the docs about this.
i.e. is
for (id val in array)
{
   NSLog(@"%@", val);
}
always going to print out the same as
for (int i = 0; i < [array count]; ++i)
{
   NSLog(@"%@", [array objectAtIndex:i]);
}
...
            
           
          
            
            Here I am iterating through an array of NSDictionary objects (inside the parsed JSON response of the EXCELLENT MapQuest directions API). I want to build up an HTML string to put into a UIWebView.
My code says:
for (NSDictionary *leg in legs ) {
    NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrat...
            
           
          
            
            Can someone help me fix my code here. I am trying to do something simple iterate through the whole array that has NSString's in it convert them to NSIntegers and assign them to a NSInteger variable.
 for  (NSInteger *itemF in myNSArray) {
     //WHERE "slotA" is an NSInteger and "itemF" is stored as an NSString and I wanna conver to NSI...
            
           
          
            
            It seems from experimentation that the collection expression is evaluated only once. Consider this example:
static NSArray *a;
- (NSArray *)fcn
{
    if (a == nil)
        a = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
    NSLog(@"called");
    return a;
}
...
for (NSString *s in [self fcn])
    NSLog(@"%@", s);
The ...