Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
- Subject: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
- From: Zhuang Xu <email@hidden>
- Date: Sat, 11 May 2013 10:50:58 +0800
On Mac Developer Library, launchApplicationAtRL return value, I Quote"The
the application could not be launched nil is returned, and the error is
specified in *error*." and the problem is when get an error, the program
can't launch an new application, and the error is not always appear.
So I am guessing, either the arguments i set was not correct, or this
method have some bugs in sandbox environment?
On Fri, May 10, 2013 at 7:58 PM, Fritz Anderson <email@hidden>wrote:
> 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
>
>
--
Best Regards, strongxu
_______________________________________________
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