【发布时间】:2013-08-29 07:15:15
【问题描述】:
为了在 youtube 应用上启动视频,我使用以下代码。
NSURL *instagramURL = [NSURL URLWithString:@"youtube://foo"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
NSLog(@"opening youtube app...");
NSString *stringURL = @"http://www.youtube.com/watch?v=H9VdapQyWfg";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
} else {
// open in UIWebView in WebViewViewController
WebViewViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:@"webinterface"];
secondView.headerLabel = @"YouTube";
secondView.webPath = @"http://www.youtube.com/watch?v=H9VdapQyWfg";
[self.navigationController pushViewController:secondView animated:YES];
}
现在客户改变主意,要求将频道放入 iPhone 应用程序中。
为了测试,我使用了链接http://www.youtube.com/user/richarddawkinsdotnet
但是当我使用此链接时,它总是在 SAFARI 中打开,而不是 youtube 应用。 :(
关于如何在 YouTube 应用中打开频道并提供链接的任何想法/建议?
【问题讨论】:
标签: ios objective-c youtube youtube-channels