On 01/04/2008, at 9:40 AM, Mac QA wrote:
On 3/31/08, Jean-Daniel Dupas <[EMAIL PROTECTED]> wrote:You can get cli arguments at anytime using NSProcessInfo. - [[NSProcessInfo processInfo] arguments];Awesome! This looks to be a much better method than parsing argv inside main before calling NSApplicationMain, which is what I've always done. Thanks!
I'm not sure it's such a good idea to process the arguments this way. The problem is that Cocoa already uses arguments for its own purposes; it allows you to set user defaults. A better bet, in my opinion, would be to use the Cocoa way of passing arguments and then use NSUserDefaults to access them. This also has the benefit of supplying you with Cocoa objects rather than you having to parse them yourself.
See<http://developer.apple.com/documentation/Cocoa/Conceptual/UserDefaults/Concepts/DefaultsDomains.html >
The only awkwardness with doing it this way is if you don't like the Cocoa way of passing arguments. If that's the case, I'd create a separate tool to do what you want (perhaps just a wrapper around your Cocoa application); I don't think you want to use your own argument style with a Cocoa application unless you can find explicit documentation that says it's safe to do so.
- Chris
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]