NSFileManager thread safety?
NSFileManager thread safety?
- Subject: NSFileManager thread safety?
- From: David Cake <email@hidden>
- Date: Mon, 16 Nov 2009 15:51:35 +0800
The following code snippet works fine from my main thread.
NSFileManager *tempFileManager = [[NSFileManager alloc] init];
NSString *path= [self tempDirPath];
if(![tempFileManager removeItemAtPath: path error: nil]) {
NSLog(@"failed to remove temp files");
}
[tempFileManager release];
But from within
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication
*)sender
or other delegate methods, it gets my EXC_BAD_ACCESS on the
removeItemAtPath call
- any suggestions? I thought NSFileManager was supposed to be
thread-safe in 10.5 and 10.6?
If this is a thread safety issue (and given the code works in the
main thread, I'm not sure what other issues might be the problem),
what is the solution to force calling it from the main thread?
Thanks In Advance
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden