Re: running an external app
Re: running an external app
- Subject: Re: running an external app
- From: Ken Thomases <email@hidden>
- Date: Mon, 26 May 2008 18:26:01 -0500
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