• 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: Andy Lee <email@hidden>
  • Date: Sat, 11 May 2013 02:54:25 -0400

On May 10, 2013, at 10:50 PM, Zhuang Xu <email@hidden> wrote:
> 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.

I can't tell if you understood Fritz's suggestion.

The documentation you are quoting says that the return value of launchApplicationAtURL:options:configuration:error: is either an instance of NSRunningApplication or nil. Fritz is saying the proper way for your code to check for an error is something like:

NSArray *arguments = [NSArray arrayWithObject:@"checkAccountArgument"];

NSError *error = nil;
NSRunningApplication *app = [[NSWorkspace sharedWorkspace] launchApplicationAtURL: url options: options configuration: [NSDictionary dictionaryWithObject:arguments forKey:NSWorkspaceLaunchConfigurationArguments] error: &error];

if (app == nil)
{
    NSLog(@"Do something here about the error %@", error);
}

What happens if you do this? The NSError might simply say something about -10810, with no more information than you already have. But maybe it will say something more specific, for example about the process table.

(And again, it was rather inconvenient for me to type the above code, and hope I did not make a typo. Next time please just paste the code instead of a screen shot. Less effort, less bandwidth, more likelihood someone will take the trouble to show corrections to the code.)

--Andy


_______________________________________________

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: Mark Munz <email@hidden>
References: 
 >Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app (From: Fritz Anderson <email@hidden>)
 >Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app (From: Zhuang Xu <email@hidden>)

  • Prev by Date: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
  • Next by Date: Failure to create bookmarkData in sandboxed app
  • Previous by thread: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
  • Next by thread: Re: NSWorkspace launchApplicationAtURL:options:configuration:error cannot launch a app
  • Index(es):
    • Date
    • Thread