pteeter
pteeter

Reputation: 31

Xcode: add Cocoa app target to command-line tool

I've got a working ObjC command-line tool, compiles fine / builds fine / runs fine / been using it for months. I finally decided to add a Cocoa-GUI to it and I'd like to utilize the classes I've already built for the command-line tool. Aside from retro-fitting IBActions & IBOutlets to make the MainMenu.xib work with the existing classes, I'm stuck with a basic problem.

The .app product won't build or run while the pre-existing command-line tool will. How do I make the .app product build and run?

Upvotes: 1

Views: 1552

Answers (1)

pteeter
pteeter

Reputation: 31

Here's how to do it.

  • From the Scheme pulldown menu (embossed gray below project name / architecture in main tool bar), select Edit Scheme...
  • Then in the ensuing popup window, choose the 'Build' item in the left-hand navigation pane.
  • In the lower left click the '+' (plus) button
  • In the ensuing target build popup sheet, choose the newly created Cocoa GUI app target and click the Add button in the lower right of the sheet
  • Assess the Target actions for the Cocoa GUI app - Analyze, Test, Run, etc. - choose your desired values
  • Click the OK button in the lower right
  • Then build the project

Notice that the formerly 'red' .app target is now 'black'. Verify that the new Cocoa app can be shown in the Finder and will launch when double-clicked.

Upvotes: 2

Related Questions