0

I want to use NSNotication to monitor a process e.g. iTunes. I want a notification when iTunes is "available", the process of iTunes is running. How to do that?

4

1 回答 1

0

如果您想要 iTunes 何时可用的通知,您必须自己发布。这意味着您必须轮询进程列表,这意味着您可能根本不需要通知,而是可以编写进程轮询代码。

如何做到这一点的一个例子是使用 shell 命令ps waux | grep iTunes | grep -v grep

于 2012-02-22T20:24:44.053 回答