Hey there,
I saw some documentation and previous questions about this, but couln't find a solution. My code looks like:
for(NSString str : NSArray){
NSLog(str);
}
The error is at the :
Thanks in advance.
Hey there,
I saw some documentation and previous questions about this, but couln't find a solution. My code looks like:
for(NSString str : NSArray){
NSLog(str);
}
The error is at the :
Thanks in advance.
I think you want something along the lines of the following:
NSArray *myArray = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
for (NSString *str in myArray)
{
NSLog(@"%@", str);
}
Note the different syntax for the loop, and using the array object, not the class name there. You can read about fast enumeration in the documentation.