I want to use a command-line with a argument to call my cocoa app , but in my cocoa app ,how to receive the argument , this argument is a file path, thank you very much!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Neat thing: use
NSUserDefaults.If you do:
Then in your code you can do:
The
keyis the-argumentswitch, and the value is the thing that comes after it. Note that this isn’t very flexible (you can’t do combine options:-a -l≠-al), but for rudimentary arguments, this is dead simple.edit with multiple arguments:
And then extract via: