> NSDictionary* attrs = [[NSFileManager defaultManager] > attributesOfItemAtPath: > @"/some/file/with/finder/comment" > error:NULL]; > > NSLog(@"extAttrs:%@", [attrs objectForKey:@"NSFileExtendedAttributes"]); > NSLog(@"attrs:%@", attrs); > NSLog(@"extAttrs:%@", [attrs objectForKey:@"NSFileExtendedAttributes"]); > [...] > Note that the first NSLog() outputs "(null)", implying that [attrs > objectForKey:@"NSFileExtendedAttributes"] has returned nil. And yet the > second NSLog()'s output shows that indeed, an object with key > "NSFileExtendedAttributes" does exist in attrs. And weirdly, the third > NSLog()'s output, now confirms that there is an object in attrs with key > "NSFileExtendedAttributes". > > WTF? > > For those interested, you can download my test project from > <http://bugs.muratnkonar.com/FileManagerBug.zip>
My first idea was that you have a typo or an additional invisible character in the first @"NSFileExtendedAttributes" string literal. But it's OK. This is really strange! You should definitely file a bug. I experimented with the code and found out that you can work around the bug by copying the NSDictionary after getting it from the NSFIleManager call: attrs = [[attrs copy] autorelease]; I'm also very curious what can cause such a strange NSDictionary behaviour. Regards, Mani -- http://mani.de - friendly software iVolume - listen to music hands-free LittleSecrets - the encrypted notepad Sahara - sand in your pocket Watchdog - baffle the curious _______________________________________________ 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