iTunes app link cannot open page in safari in simulator and also iDevices
Asked Answered
U

4

22

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) .

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.

[[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??

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??

Ungava answered 30/11, 2012 at 12:43 Comment(0)
S
26

Kjuly's answer is 90% correct (and +1 to 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:

+ (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.

Sammer answered 1/12, 2012 at 11:44 Comment(0)
D
10

Take a try with this URL:

http://itunes.apple.com/app/<appId>

Note: Replace <appId> with your desire App's ID, e.g. id543028543.

Diderot answered 30/11, 2012 at 12:53 Comment(2)
ya. There is no problem in that. 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??Ungava
yep. I am still waiting for correct solution. I tried whatever I can from my side.Ungava
D
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'.

Dimension answered 30/11, 2012 at 12:55 Comment(0)
W
-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.

Wig answered 2/11, 2013 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.