私は、iOS 用の Cordova/phonegap フレームワークを使用して xcode でアプリを構築しています。このフレームワークには、YouTube プレーヤー コードが埋め込まれた html が表示されます。iOS は、この YouTube プレーヤーにヒットすると、ユーザーを YouTube アプリにリダイレクトするようです。cordova 1.5.0 では次のコードが機能していましたが、1.6.1 では機能していないようです。それを機能させるために、なぜ、または何を変更する必要があるかについてのアイデアはありますか?
YouTube が開かないようにするコードと、自分自身を振る舞うためのリンク
- (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 ];
}
}