• 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
Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???


  • Subject: Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
  • From: Laurent Daudelin <email@hidden>
  • Date: Thu, 23 Apr 2009 17:50:34 -0700

I'm trying to use this NSWorkspace method to launch an application and print a document. I provide it with a FSRef-based NSAppleEventDescriptor but the only thing the workspace does is launching the app. Here is part of the code:

NSURL *documentURL = [[[NSURL alloc] initFileURLWithPath:[[openPanel filenames] objectAtIndex:c]] autorelease];
NSURL *applicationURL = NULL;
OSStatus resultCode = LSGetApplicationForURL((CFURLRef)documentURL, kLSRolesAll, NULL, (CFURLRef *)&applicationURL);
if (resultCode != noErr)
{
NSRunAlertPanel(NULL, [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"CouldntFindAppForDocument", @""), [[[openPanel filenames] objectAtIndex:c] lastPathComponent]], NULL, NULL, NULL);
return ;
}
NSBundle *appBundle = [NSBundle bundleWithPath:[applicationURL path]];
BOOL couldLaunchApp = NO;
NSAppleEventDescriptor *descriptor = [self descriptorWithPath: [[openPanel filenames] objectAtIndex:c]];
if (descriptor != NULL)
couldLaunchApp = [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:[appBundle bundleIdentifier] options:NSWorkspaceLaunchAndPrint additionalEventParamDescriptor:descriptor launchIdentifier:NULL];
if ( ! couldLaunchApp)
NSRunAlertPanel(NULL, [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"CouldntAddDocumentToReader", @""), [[[openPanel filenames] objectAtIndex:c] lastPathComponent]], NULL, NULL, NULL);


What am I doing wrong?

Thanks in advance.


-Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software email@hidden Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

_______________________________________________

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: Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: NSTableView variable row height and noteHeightOfRowsWithIndexesChanged during live resize
  • Next by Date: Re: Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
  • Previous by thread: Re: Core Data and the Application Delegate
  • Next by thread: Re: Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
  • Index(es):
    • Date
    • Thread