Re: running an external app
Re: running an external app
- Subject: Re: running an external app
- From: Nathan <email@hidden>
- Date: Mon, 26 May 2008 19:30:01 -0400
I'm going to get sick of saying this eventually... this project is to
learn, I've gone through one great tutorial already and I'm waiting on
cocoa programming for mac os x to arrive.
So if I use the exact line you just told me it will work? I will try
and understand that line in a moment.
Thanks!
On May 26, 2008, at 7:26 PM, Ken Thomases wrote:
On May 26, 2008, at 6:08 PM, Nathan wrote:
I'm running into problems now....
bool runApp;
[runApp launchApplication: "Interface Builder"];
I get these warnings:
warning: invalid receiver type bool
warning: passing argument 1 of 'launchApplication:' from
incompatible pointer type
The above syntax suggests that you're attempting to send a message
to a "bool". What would you expect a bool (if such a thing existed)
to do with the message "launchApplication:"? Is launching
applications part of the responsibilities of bools?
You need an actual object to send the message to. Furthermore, you
need that object to be an instance of a class which actually handles
the launchApplication: message.
When you were told about the launchApplication: message, you were
also told that it was a method of the class NSWorkspace. So, you
need an instance of that class. NSWorkspace is a "singleton", which
means that there's only ever supposed to be one instance of it. You
aren't meant to alloc and init one, you should request the single,
shared instance with the sharedWorkspace class method.
For example:
[[NSWorkspace sharedWorkspace] launchApplication:@"Interface
Builder"];
You should really review the fundamentals of Objective-C and Object-
oriented Programming.
Cheers,
Ken
_______________________________________________
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