• 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
Re: Calling Cocoa APIs from a command line application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling Cocoa APIs from a command line application


  • Subject: Re: Calling Cocoa APIs from a command line application
  • From: Dave Keck <email@hidden>
  • Date: Sat, 13 Sep 2003 13:33:55 -0400

I want to call an NSWorkspace method from a simple command-line script. I
naively thought this would work:

Hi,

The simplest way to do this (I think) is to create a Foundation tool in Project Builder. Then drag the AppKit framework from the /System/Library/Frameworks directory into the "External Frameworks and Libraries" folder in PB. This allows you to use the AppKit framework within your project... therefore, the following code works fine:

#import <Foundation/Foundation.h>
#import <AppKit/NSWorkspace.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// insert code here...
NSLog(@"Hello, World!");
[[NSWorkspace sharedWorkspace] noteFileSystemChanged: @"/foo/bar"];
[pool release];
return 0;
}

- - -

Dave Keck
If I were smart I'd own a company to tell you the the name of.
"Contrariwise," continued Tweedledee, "if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Calling Cocoa APIs from a command line application (From: John Siracusa <email@hidden>)

  • Prev by Date: Re: Calling Cocoa APIs from a command line application
  • Next by Date: Re: Another autorelease question
  • Previous by thread: Re: Calling Cocoa APIs from a command line application
  • Next by thread: Can you bypass a file when using initWithContentsOfFile?
  • Index(es):
    • Date
    • Thread