Я пытаюсь реализовать обнаружение USB, используя метод NSworkspacenotification, используя этот код
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[[[NSWorkspace sharedWorkspace] notificationCenter]addObserver: [NotifTarget class] selector: @selector(mountNotification:) name: NSWorkspaceDidMountNotification object: nil];
[[[NSWorkspace sharedWorkspace] notificationCenter]
addObserver: [NotifTarget class]
selector: @selector(unmountNotification:)
name: NSWorkspaceDidUnmountNotification object: nil];
[[NSRunLoop currentRunLoop] run];
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
Этот код не обнаруживает USB и выводит:
Hello, World!
Program ended with exit code: 0
Что не так с этим кодом?