• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Use of AppKit in command-line app on headless node
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use of AppKit in command-line app on headless node


  • Subject: Use of AppKit in command-line app on headless node
  • From: Rick Hoge <email@hidden>
  • Date: Mon, 11 Aug 2008 14:37:58 -0400


Hi -

I am trying to factor some frameworks so that code used in a document- based Cocoa app can be shared with command-line tools that might run on a headless node (no window server).

I've seen some discussion in the past on questions such as whether NSImage and related classes can be used headless. It seems that this works, but it's necessary to initialize and NSApplication instance for the classes to work correctly.

I realize that many AppKit functions will not be meaningful in a headless context. However I am wondering if, for example, it would be possible (and safe) to use an NSDocument subclass instance in the following way in a headless app:

  MyDocument *doc = [[[MyDocument] alloc] init];
  [doc readFromURL:url ofType:type error:error];

The idea would simply be to use the instance as a container for some data, and use the file read and write methods I've already implemented for the doc-based interactive application. This seems to work in some simple test apps I've written, but I'm wondering if there is anything risky about this that could become a problem in the future.

Also, when is it necessary to initialize an NSApplication instance? Is this just an NSImage thing? or is it a more general AppKit requirement.

Thanks for any suggestions,

Rick






_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Use of AppKit in command-line app on headless node
      • From: Rick Hoge <email@hidden>
  • Prev by Date: Re: Challenge 18 in Hillegass Book
  • Next by Date: Opening an external file in a external application
  • Previous by thread: Re: Delayed termination to allow release
  • Next by thread: Re: Use of AppKit in command-line app on headless node
  • Index(es):
    • Date
    • Thread