Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
NSNotication を使用して、iTunes などのプロセスを監視したいと考えています。iTunes が「利用可能」、iTunes のプロセスが実行されているときに通知が必要です。どうやってするか?
iTunes が利用可能になったときに通知が必要な場合は、自分で投稿する必要があります。これは、プロセス リストをポーリングする必要があることを意味します。つまり、通知はまったく必要ないかもしれませんが、代わりにプロセス ポーリング コードを記述できます。
これを行う方法の 1 つの例は、シェル コマンドを使用することですps waux | grep iTunes | grep -v grep。
ps waux | grep iTunes | grep -v grep