I’ve trying to get callback after file operation performing, but I can’t catch NSWorkspaceDidPerformFileOperationNotification posting.
[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(finderDidFileOperation:) name:NSWorkspaceDidPerformFileOperationNotification object:[NSWorkspace sharedWorkspace]];
[[NSWorkspace sharedWorkspace] performFileOperation:fileOp source:source destination:item.fullPath files:objects tag:&tag];
object:nil
also didn’t works and
[[NSWorkspace sharedWorkspace] addObserver:self forKeyPath:NSWorkspaceDidPerformFileOperationNotification options:NSKeyValueObservingOptionNew context:nil];
too.
What I’ve doing wrong?
I think the key here is that the
NSWorkspaceposts the notification to its notification center, not the global default one. From the docs:Try registering for the notification with that notification center instead, like this: