cordova/eclipse – Phonegap CLI : IOS open safari by link

http://stackoverflow.com/questions/15349630/phonegap-open-link-in-mobile-safari
La procedura che ho seguito io è questa:
nella app già pubblicata per android ho i link con target=”_system” e non avevo nessuna intenzione di andarli a ripassare uno per uno.
Sono andata ad aprire il file MainViewController.m che si trova dentro a Classes..
premetto che non ne so niente di objectiveC.
Quindi ho copiato il pezzo di codice che mi davano su stackoverflow in fondo alla pagina, ma Xcode mi dava un errorone.
Quindi ho letto con sguardo ebete il codice sopra e nei commenti ti dice:
decommenta queste righe per sovrascriver eil comando.
Ho notato che una era identica a quella che ci serve, ovvero parla di cosa fare in caso di webview.
quindi l’ho decommentata, ho aggiunto questa parte di codice prima del suo if finale..

NSURL *url = [request URL];
    // Intercept the external http requests and forward to Safari.app
    // Otherwise forward to the PhoneGap WebView
    if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
        [[UIApplication sharedApplication] openURL:url];
        return NO;
    }

Quindi nel totale risulta così:

#pragma mark UIWebDelegate implementation
 
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
 
return [super webViewDidFinishLoad:theWebView];
}
 
/* Comment out the block below to over-ride */
 
/*
 
- (void) webViewDidStartLoad:(UIWebView*)theWebView
{
return [super webViewDidStartLoad:theWebView];
}
 
- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
{
return [super webView:theWebView didFailLoadWithError:error];
}*/
 
- (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
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}