ios用のCordova/phonegapフレームワークを使ってxcodeにアプリを構築しています。これには埋め込まれたyoutube playerコードが含まれているHTMLが表示されます。 iOSは、このYouTubeプレーヤーにヒットすると、ユーザーをYouTubeアプリにリダイレクトするようです。コードヴァーバー1.5.0では、以下のコードが働いていましたが、1.6.1ではそうではありません。どのようなアイデアか、何が変わる必要があるのですか?youtube videos xcode/cordovaでyoutubeアプリを開く1.6.1
コードは、ユーチューブの開口部を停止するとのリンクは自己
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
NSString* urlString = [url absoluteString];
if([urlString rangeOfString:@"http://www.youtube.com/embed"].location != NSNotFound) {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
else if (([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"])) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}