Accessing command line arguments in Objective-C
Is there any complete documentation (the interface is present in
crt_externs.h) about this functions :
I can’t get any documentation on the apple website about this functions.
- Launching an Mac App with Objective-C/Cocoa
- Subclassing an NSTextField
- NSMutableArray - force the array to hold specific object type only
- How do I automatically activate an item in the OS X Services Menu
- How to programmatically register a custom URL scheme?
- Reference count is still 1 after , when it should be deallocated
3 Solutions Collect From Internet About “Accessing command line arguments in Objective-C”
If all you need to do is get the command line arguments in Cocoa, you can do:
NSArray *arguments = [[NSProcessInfo processInfo] arguments];
You can also access the commandline arguments using
NSUserDefaults as described in the blogposts by Greg Miller or Alex Rozanski.
You basically get an
NSUserDefaults instance through a call to
[NSUserDefaults standardUserDefaults] and then use messages like
stringForKey: to access the values.
The official Apple documentation can be found here.
As those functions are prefixed with an “_”, that’s usually a sign that they are private, and not meant to be used by you. If you need to get the command line arguments, a better way to do it would be to look up NSProcessInfo.
- Check iOS deployment target of a static library
- How do I install Frank when my project is using Cocoapods?
- How to prevent Xcode 4 from jumping to the main.m file after every Run?
- What is AWDL (Apple Wireless Direct Link) and how does it work?
- Generics call with Type T in Swift
- How can I programmatically find Swift's version?
- Getting username and profile picture from Facebook iOS 7
- Download and install an ipa from url on iOS
- Convert String to NSDate in Swift
- How to select Multiple images from UIImagePickerController
- Parse API – Facebook login not working on the iPhone device
- Can't add a corner radius and a shadow
- Xcode4 show all output (remove “Showing first 200 notices only”)
- Where can I find a CSV to NSArray parser for Objective-C?
- Facebook SDK 3.0: how to receive user's e-mail?