用视频启动 Youtube 应用程序 [英] Launch Youtube app with a video
问题描述
我有一个带有 UIButton 的应用程序,我希望,当我单击 iPhone 启动 Youtube 应用程序的按钮时,我的视频可以直接开始播放,我已经尝试过以下代码:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=xxx"]];
但它会在视频页面中启动 Safari.我正在实际设备上试用我的应用.
谢谢
正如其他人所说,这确实应该打开 YouTube 应用程序 - 如果您正在实际设备上测试它.>
请注意,如果您在模拟器中运行它,它将在 Safari 中打开,因为模拟器没有 YouTube 应用.
I have an app with a UIButton, I wish, when I click the button that the iPhone launches Youtube app with directly my video ready to start to play, I've tried this code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=xxx"]];
But it launches Safari in the video page. I'm trying my app on actual device.
Thanks
As others have mentioned, this should indeed open the YouTube App- if you're testing it on your actual device.
Be aware that if you're running it in the simulator, it will open in Safari instead, as the simulator does not have the YouTube app.
这篇关于用视频启动 Youtube 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!