• 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: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app


  • Subject: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
  • From: Fritz Anderson <email@hidden>
  • Date: Fri, 10 May 2013 06:58:07 -0500

On 1 May 2013, at 10:29 PM, Zhuang Xu <email@hidden> wrote:

> I am using NSWorkspace launchApplicationAtURL:options:configuration:error
> launch the same app in Sandbox, sometimes there is an error:
>
> "The operation couldn't be completed. (OSStatus error - 10810)"
>
> this error appears occasionally not all the time. Is anybody know what's
> going on? Am I missing something?

You don't say whether the method actually fails.

The code sample you attach does not capture the result of the launchApplication… method. I am guessing that you don't use the result, but are relying on the NSError object returned by reference.

This is a mistake. By convention (I hear one or two Cocoa methods are exceptions), methods that take NSError-reference arguments are free to set an error object even if no error occurred. Many methods nil-out the referenced error pointer, but they don't have to. The returned error object is valid only if the principal return value of the method indicates failure (usually nil).

Capture the return value, check for nil, and only then examine the error object.


> and in Mac OS 10.7.4 and 10.7.5 when I set a dictionary to the third
> parameter:
>
> [image: Inline image 1]
>
> but in new app's main function, argv array don't have
> "checkAccountArgument" parameter.
>
> in Mac OS 10.8.5 it seems OK.

I'm sure this isn't your problem, but does the URL in the first argument in the method point to an .app bundle? I would not expect the method to work reliably with a bare UNIX tool.

	— F

--
Fritz Anderson
Xcode 4 Unleashed: 4.5 supplement for free!
http://www.informit.com/store/xcode-4-unleashed-9780672333279


_______________________________________________

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


  • Follow-Ups:
    • Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
      • From: Zhuang Xu <email@hidden>
  • Prev by Date: Re: how to run NSApplicationMain() in child process?
  • Next by Date: Re: What am I looking for in the documentation?
  • Previous by thread: Re: how to run NSApplicationMain() in child process?
  • Next by thread: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
  • Index(es):
    • Date
    • Thread