View Single Post
Old 01-25-2004, 12:17 AM   #1 (permalink)
juanvaldes
Banned
 
Location: shittown, CA
[obj-c] not key value coding-compliant for the key NSDevicePath or F#$King Docs!!

okay so in my application I have one of my classes register for the "NSWorkspaceDidUnmountNotification" notification. Fine. Working, when I eject a volume I get the notification and it calls my function. Cool up to here.

Here is the code in said function.
Note: NSDictionary is a hashtable (if you've never encountered the term)
PHP Code:
NSDictionary *instructions = [note object];
NSLog(@"mediaWasEjected - %@", [instructions valueForKey:@"NSDevicePath"]); 
But when it executes I get this error message.

Quote:

2004-01-24 23:58:41.416 iMedia[8611] Exception raised during posting of notification. Ignored. exception: [<NSWorkspace 0x33c2e0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key NSDevicePath.
from apple docs, Notifications are at the bottom.
Quote:
NSWorkspaceDidUnmountNotification
Posted when the Finder has unmounted a device.

The notification object is the shared NSWorkspace instance. The userInfo dictionary contains the following information:

Key_______________Value
@"NSDevicePath" ____The path where the device was previously mounted, as a string.
So I get the dictionary and ask it for the value with key @"NSDevicePath" but the dictionary says "Nope" and raises a exception.

*sigh*
okay I feel better now.
juanvaldes is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37