Question

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

Was it helpful?

Solution

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.

OTHER TIPS

Take a try with this URL:

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

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

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top