Hi All, I've got a method that refreshes a list of files in a directory. The code executes properly on the first invocation, but crashes on the second invocation. The cause of the crash is walker = [fileManager enumeratorAtPath:directory].
Any ideas on the cause? I experience the crash with both methods of retrieving the file manager. Are there known issues with enumeratorAtPath? Jeff NSString* directory = nil; NSFileManager* fileManager = nil; NSDirectoryEnumerator* walker = nil directory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; if(directory == nil) /* handle error and exit */ // fileManager = [NSFileManager defaultManager]; fileManager = [[NSFileManager alloc] init]; if(fileManager == nil) /* handle error and exit */ walker = [fileManager enumeratorAtPath:directory]; if(walker == nil) /* handle error and exit */ NSString* file = nil; while((file = [walker nextObject]) != nil) { BOOL isDirectory = YES; if([fileManager fileExistsAtPath:file isDirectory:&isDirectory] && !isDirectory) [files addObject:file]; } ... [fileManager release]; ***** According to 'NSFileManager Class Reference' (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html): In iOS and Mac OS X v 10.5 and later you should consider using [[NSFileManager alloc] init] rather than the singleton method defaultManager. Instances of NSFileManager are considered thread-safe when created using [[NSFileManager alloc] init]. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com