I hope this may be duplicate question. But none of the answers didn't hard help me. I am trying to open a link from my iOS application. When I press the button, It opens the safari app and it always says an alert "Safari cannot open the page because the address is invalid". Here it is a link looks like the same https://itunes.apple.com/gb/app/app_name/id(appId) .
我希望这是重复的问题。但是没有一个答案对我没有帮助。我正在尝试从我的iOS应用程序中打开一个链接。当我按下按钮时,它会打开safari应用程序,它总是提示“safari不能打开页面,因为地址无效”。这里有一个链接看起来像https://itunes.apple.com/gb/app_name/id (appId)。
I don't think it is a good place to post the exact the app link. So the above link is dummy link exactly look like mine. Why the error always happening when I try to open the link. I tried in simulator and also in iPod. Same error occurs. If I try the same link with Safari in MAC OS then it works. Here it is a code I am using to open the safari from my app with a link.
我不认为这是个发布app链接的好地方。所以上面的链接是假链接,和我的一模一样。为什么当我试图打开链接时,错误总是发生。我试过模拟器,也试过iPod。同样的错误发生。如果我在MAC OS中使用Safari尝试同样的链接,那么它就可以工作了。这里有一个代码,我正在用它从我的应用程序中打开safari。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/gb/app/app_name/id(appId)"]];
I am from India. The above link contains gb. Is that link can only open from Great Britain??
我来自印度。上面的链接包含gb。这个链接只能从英国开放吗?
UPDATE:
更新:
I have good working network. And I tried one more thing. I opened my safari app in simulator and search my app in google and clicking that link shows the same error. Is that a problem with that link in apple side itself??
我有很好的工作网络。我又试了一件事。我在模拟器中打开我的safari应用程序,在谷歌中搜索我的应用程序,点击这个链接会显示相同的错误。这是苹果这一环节本身的问题吗?
4 个解决方案
#1
23
Kjuly's answer is 90% correct (and +1 to Kjuly!).
Kjuly的答案90%是正确的(+1到Kjuly!)
If you look at the at the Appirater code, and in the .m file that has the function that opens up the app store (it's the "rateApp:" method) I see this bit of code:
如果你看Appirater代码,在.m文件中有打开app store的功能(它是“rateApp:”方法)我看到了这段代码:
+ (void)rateApp {
#if TARGET_IPHONE_SIMULATOR
NSLog(@"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
So no matter what you try, you are not going to be able to open the App Store app within the simulator. The App Store app does not exist in the simulator, so that's why you get a "not found" error when your web view attempts to redirect to it. This should work fine on the actual device that has the App Store app installed.
不管你怎么尝试,你都无法在模拟器中打开App Store应用。App Store应用程序在模拟器中不存在,所以当你的web view试图重定向到它时,你会得到一个“not found”错误。在安装了App Store应用程序的实际设备上,这应该是可行的。
#2
6
Take a try with this URL:
试试这个URL:
http://itunes.apple.com/app/<appId>
Note: Replace <appId>
with your desire App's ID, e.g. id543028543
.
注意:将
#3
0
That is a possibility as you are specifying the region to which the app belongs or is hosted on the app store under. Try loading the the url without the region 'gb'.
这是一种可能性,因为您正在指定应用程序所属的区域或托管在应用程序商店下。尝试在没有“gb”区域的情况下加载url。
#4
-1
I was having same problem. Links in email not opening, links to App Store not working and App Store not searching or loading apps. I called Appke support. A reset worked! Go to settings to find how the reset under general. It doesn't delete anything either.
我也有同样的问题。邮件中的链接不打开,应用商店的链接不工作,应用商店不搜索或加载应用。我叫Appke支持。重置成功了!进入设置,以发现如何重置一般。它也不删除任何内容。
#1
23
Kjuly's answer is 90% correct (and +1 to Kjuly!).
Kjuly的答案90%是正确的(+1到Kjuly!)
If you look at the at the Appirater code, and in the .m file that has the function that opens up the app store (it's the "rateApp:" method) I see this bit of code:
如果你看Appirater代码,在.m文件中有打开app store的功能(它是“rateApp:”方法)我看到了这段代码:
+ (void)rateApp {
#if TARGET_IPHONE_SIMULATOR
NSLog(@"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
So no matter what you try, you are not going to be able to open the App Store app within the simulator. The App Store app does not exist in the simulator, so that's why you get a "not found" error when your web view attempts to redirect to it. This should work fine on the actual device that has the App Store app installed.
不管你怎么尝试,你都无法在模拟器中打开App Store应用。App Store应用程序在模拟器中不存在,所以当你的web view试图重定向到它时,你会得到一个“not found”错误。在安装了App Store应用程序的实际设备上,这应该是可行的。
#2
6
Take a try with this URL:
试试这个URL:
http://itunes.apple.com/app/<appId>
Note: Replace <appId>
with your desire App's ID, e.g. id543028543
.
注意:将
#3
0
That is a possibility as you are specifying the region to which the app belongs or is hosted on the app store under. Try loading the the url without the region 'gb'.
这是一种可能性,因为您正在指定应用程序所属的区域或托管在应用程序商店下。尝试在没有“gb”区域的情况下加载url。
#4
-1
I was having same problem. Links in email not opening, links to App Store not working and App Store not searching or loading apps. I called Appke support. A reset worked! Go to settings to find how the reset under general. It doesn't delete anything either.
我也有同样的问题。邮件中的链接不打开,应用商店的链接不工作,应用商店不搜索或加载应用。我叫Appke支持。重置成功了!进入设置,以发现如何重置一般。它也不删除任何内容。