objective c - How to grab command line arguments when application is reopen on Mac -
i have write app on mac os x, want open command line 2 arguments. simple. grab arguments using [[nsprocessinfo processinfo] arguments]. need grab new arguments when reopen application. how that? processinfo gives me arguments write first time. clear do: open myapp.app --args -url1 http://apple.com -url2 /desktop have in processinfo 2 arguments: url1 , url2.
now want reopen aplication new arguments (applicattion still working in background): open myapp.app --args -url1 http://somethingelse.com -url2 /desktop/newlibrary when use nsprocessinfo have older arguments(http://apple.com , /desktop).
how can grab new arguments?
sorry english :(
by default open(1) command line tool switch existing instance of program. since not call program's main entry point arguments ignored. set when program launches , have launch new instance of program if want use other command line arguments.
use open -n launch new instance of program. launch new instance if instance exists.
Comments
Post a Comment