On Feb 15, 2010, at 1:53 AM, [email protected] wrote:

> RandomObj *fooObj = [[RandomObj alloc]init];
> 
> NSEnumerator *enumerator = [fooArray objectEnumerator];
>  id obj;
>  while ( obj = [enumerator nextObject] ) {
>  NSLog( @"%@", obj);
>  NSLog( @"%d", fooObj.id);
>  NSLog( @"%@", fooObj.name);
> }

I can't really follow what this code is supposed to do. fooObj is a 'blank' 
object, whose properties don't get set to anything, but you print out its id 
and name property every time through the loop. Did you mean to use obj instead 
of fooObj in the last two NSLog calls? In that case, what's fooObj for?

Also, it's a heck of a lot easier to iterate over an array by using
        for (id obj in fooArray) { ... }
unless you need your app to remain compatible with the thirty-two Mac users who 
still run 10.4.

—Jens_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to