• 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: NSTask Permission denied
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask Permission denied


  • Subject: Re: NSTask Permission denied
  • From: Sherm Pendley <email@hidden>
  • Date: Sat, 20 Nov 2004 05:41:41 -0500

On Nov 19, 2004, at 6:06 PM, John C. Randolph wrote:

On Jul 21, 2004, at 8:11 PM, Jim Ways wrote:

I get the following dump when i attempt to use [NSTask
launch]. I want to launch a UEF under libary but i
cant even seem to lauch anything in applications.

runtime = [[NSTask alloc] init];
[runtime setLaunchPath:
@"/Applications/TextEdit.app"];
[runtime launch];

 *** NSTask: Task create for path
/Applications/TextEdit.app failed: 13, "Permission
denied".

Any ideas? Thanks Guys!

Do you actually need to launch TextEdit as a sub-process, or would NSWorkspace's -launchApplication: API suffice?

-jcr


John's question is spot-on - if NSWorkspace will work for you, it's probably better to use it.


But, if you really want to launch a child process for some reason, the problem with the code above is that it's trying to execute a directory. You need to specify the path to the binary inside the .app bundle if you want to run it.

Alternatively, you could run /usr/bin/open with NSTask, and pass it two arguments: "-a", "TextEdit". That's probably a better choice, as it doesn't rely on the directory layout within the .app bundle.

sherm--

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSTask Permission denied (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: Problem with some clicks not registering in 10.3.6?
  • Next by Date: Cocoa program to Activate/Deactivate Screensaver
  • Previous by thread: Re: NSTask Permission denied
  • Next by thread: NSSegmentedControl as toolbar item of a textured window
  • Index(es):
    • Date
    • Thread