3
我試圖獲得執行文件操作後的回調,但我無法捕獲NSWorkspaceDidPerformFileOperationNotification發佈。如何捕獲NSWorkspaceDidPerformFileOperationNotification?
[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];
對象:無
也沒有工作和
[[NSWorkspace sharedWorkspace] addObserver:self forKeyPath:NSWorkspaceDidPerformFileOperationNotification options:NSKeyValueObservingOptionNew context:nil];
了。
我做錯了什麼?
我認爲'[NSWorkspace通知中心]'將無法正常工作'notificationCenter'是一個實例方法。應該可以用'[[NSWorkspace sharedWorkspace] notificationCenter]'註冊。 –
@AnalogFile好趕上...我更新了示例 – highlycaffeinated
非常感謝!它解決了我的問題。 – Akki