Safari中的打开URL失败 [英] Open URL failure in Safari

查看:240
本文介绍了Safari中的打开URL失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了我的应用程序.我需要直接在iPhone,Safari浏览器视图中打开URL.

I created my application. I need to open URL in iPhone, safari view directly.

我的代码如下:

        NSString *email = [NSString stringWithFormat:@"http://itunes.apple.com/us/album/music/id186152317?i=186153149&uo=4"];
         email = [email stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
         NSURL *url = [NSURL URLWithString:email];
         if (![[UIApplication sharedApplication] openURL:url])
         NSLog(@"%@%@",@"Failed to open url:",[url description]);
         [super viewDidLoad];

但是我的问题是,Safari视图已打开.但是未打开URL.显示错误.错误是

But my problem is, the Safari view is opened. But the URL is not opened. It is showing error. The error is

无法打开页面Safari无法打开页面,因为地址无效

Cannot Open Page safari cannot open the page because the address is invalid

但是该URL是在浏览器中打开的.

But the URL is opened in browser.

有人知道使用Objective C在iPhone的Safari中打开此URL的解决方案吗?

Does anyone know the solution, to open this URL in Safari in iPhone using Objective C?

推荐答案

您可以使用 http://itunes. apple.com/linkmaker/以获得确切的链接.希望对您有帮助

You can use http://itunes.apple.com/linkmaker/ to get exact link.Hope it helps

这篇关于Safari中的打开URL失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆