开发者

Cocoa application with an optional command line mode

I'm about to start a new Cocoa project from scratch and one of the requirements I have already been given is being able to choose either a Cocoa GUI or a command line mode from the same executable. Scriptability may be a possible addition in the future but that is not a concern right now.

What is the best strategy for going about this in Cocoa, especially if I want to maintain certain Cocoa features like Obj-C garbage c开发者_如何学编程ollection?


Xcode will generate a main.m for you with a main function that has the command line arguments. You should parse them and if you need to stay in command-line mode, never do the application startup. If you are being a GUI, just start normally.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜