我正在尝试通过 NSTask 使用命令行实用程序压缩文件。
伪代码:
controller:
init:
register_self_as_observer_of_nstask_notifications
startZip(file):
file = somefileobject
task = "zip" with file path as argument
task.launch
notification_listener(notification):
task = notification.get_object
file = task.???
那么我怎样才能找出通知所属的文件对象呢?我通常使用 userInfo 字典来处理这些事情,但 NSTask 没有这样的选项。来自Apple Dev:此通知不包含 userInfo 字典。
谢谢!