1

I would like to open QuickTime and play a remote file.

I use the following code:

NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/bin/open"];
[task setArguments:[NSArray arrayWithObjects: @"/Applications/QuickTime Player.app", @"http://...", nil]];
[task launch];

But the console says:

Program received signal: “EXC_BAD_ACCESS”. sharedlibrary apply-load-rules all

What's wrong? I also mod the third line:

[task setArguments:[NSArray arrayWithObjects: @"-a", @"/Applications/QuickTime Player.app", @"http://...", nil]];

I only found an answer for non native code: How can I start QuickTime and have it start playing a url?

Thanks very much for some hints or samples!

Community
  • 1
  • 1
user1756209
  • 573
  • 10
  • 23
  • The second version is correct; the first version will open QuickTime Player and then open the document in some random app. I can't see anything wrong with this code, so most probably the crash was elsewhere—what made you single this code out in particular? – Peter Hosey Jun 04 '13 at 20:31

1 Answers1

0

Problem solved: Using ASBQuickTimeApplication.

user1756209
  • 573
  • 10
  • 23
  • Is that third-party code or do you mean you're using the Scripting Bridge? Either way, you don't need such a heavyweight solution. Actually, you don't even need NSTask: You can open a document in a specific application using Launch Services or NSWorkspace. – Peter Hosey Jun 04 '13 at 20:33