Strange NSEnumerator Behavior
Strange NSEnumerator Behavior
- Subject: Strange NSEnumerator Behavior
- From: Daniel Todd Currie <email@hidden>
- Date: Fri, 15 Oct 2004 10:06:56 +0900
I have the following block of code:
NSLog(@"filenamesArray = %@, count = %i", filenamesArray,
[filenamesArray count]);
NSEnumerator *fileEnumerator = [(NSArray *)filenamesArray
objectEnumerator];
id filePath;
filePath = (NSString *)[fileEnumerator nextObject];
NSLog(@"filePath = %@", filePath);
Which yields this run log:
2004-10-15 09:58:57.697 myApp[6088] filenamesArray = <CFArray 0x34af80
[0xa01900e0]>{type = mutable-small, count = 1, values = (
0 : <CFString 0x395010 [0xa01900e0]>{contents =
"/Users/dtcurrie/Documents/Downloads/Rax.dmg"}
)}, count = 1
2004-10-15 09:58:57.697 myApp[6088] filePath =
/Users/dtcurrie/Documents/Downloads/Rax.dmg
As expected, this works fine.
However the following block of code:
NSLog(@"filenamesArray = %@, count = %i", filenamesArray,
[filenamesArray count]);
NSEnumerator *fileEnumerator = [(NSArray *)filenamesArray
objectEnumerator];
id filePath;
while(filePath = (NSString *)[fileEnumerator nextObject]);
{
NSLog(@"filePath = %@", filePath);
}
Yields this run log:
2004-10-15 09:59:40.172 myApp[6098] filenamesArray = <CFArray 0x314bd0
[0xa01900e0]>{type = mutable-small, count = 1, values = (
0 : <CFString 0x38b6c0 [0xa01900e0]>{contents =
"/Users/dtcurrie/Documents/Downloads/Rax.dmg"}
)}, count = 1
2004-10-15 09:59:40.172 myApp[6098] filePath = (null)
What could possibly be going on here? Am I just overlooking something
obvious? I have never had trouble with NSEnumerators in the past...
Thanks in advance,
-- DTC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden