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 (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]

Reply via email to