On Jul 8, 2011, at 7:13 AM, Hirendra Rathor wrote: > I have written an .app which is launched many times until the running > instance shuts down finally. The code > to start it looks like this: > > NSTask* task = [[NSTask alloc] init]; > [task setLaunchPath: @"/usr/bin/open"];
That’s pretty awkward! The preferred way to launch an app is to use the NSWorkspace methods, or LaunchServices (a lower-level procedural API that gives you more options.) > The idea is to launch the application with different arguments so that it can > do different > stuff every time. This design is inspired as a result of porting this code > from other platforms, so I > would be willing to look at other design alternatives if it does not work > well in the Mac world. However > I would like to give existing solution a try before I do that. Don’t use command-line args for this. To send parameters when launching an application, use AppleEvents. LaunchServices supports sending an arbitrary/custom AppleEvent to an app while launching it. —Jens_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com