Handling command line arguments from NSPersistentDocument
I've an application based on NSPersistentDocument, it has three different views based on diffrent conditions and data and every works fine.
Now the customer also wants to run the application from shell scripts.
For example
open -a myapp.app --args -data list.csv
launch the app opening the view A (a data grid)
open -a myapp.app --args -data list.myownformat -startline 6
launch the app opening the view B (a pie chart)
Where and how I must handle command line arguments inside my NSPersistentDocument subclass?
Many applications allow the dual launch GUI or CLI that l开发者_如何学Caunch GUI but I'm unable to understand how to achieve this result from a NSPersistentDocument.
Any best practice, hint, source code is welcomed
NSPersistentDocument is not the place to handle it, but the application delegate. I don't have the documentation at hand, please search for it in the cocoa documentation.
精彩评论