如何从我的应用程序启动应用商店

时间:2022-10-13 19:31:24

Im trying to implement button which opens app store application from my app. I use this simple line of code, which opens safari but not app store application.

我试图实现从我的应用程序打开应用商店应用程序的按钮。我使用这个简单的代码行,打开safari但不打开app store应用程序。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://itunes.apple.com/sk/app/tweetie-2/id333903271?mt=8"]];

I dont know whats wrong, is the URL format correct? I was following this document.

我不知道什么是错的,URL格式是否正确?我正在关注这份文件。

All related questions in * are outofdate I suppose.

我认为*中的所有相关问题都是过时的。

2 个解决方案

#1


0  

If you want to bypass Safari, change 'itunes' in the URL to 'phobos'. Note that this will fail in the simulator, but most definitely works on the device.

如果您想绕过Safari,请将URL中的“itunes”更改为“phobos”。请注意,这在模拟器中会失败,但绝对可以在设备上运行。

#2


0  

According to the documentation, iTunes affiliate links have to process several redirects in order to wind up in iTunes. Follow the example to create an NSURLConnection, set yourself as its delegate, and use the string it ends up with to open with UIApplication.

根据文档,iTunes联盟链接必须处理几个重定向,以便在iTunes中结束。按照示例创建NSURLConnection,将自己设置为其委托,并使用最终的字符串打开UIApplication。

#1


0  

If you want to bypass Safari, change 'itunes' in the URL to 'phobos'. Note that this will fail in the simulator, but most definitely works on the device.

如果您想绕过Safari,请将URL中的“itunes”更改为“phobos”。请注意,这在模拟器中会失败,但绝对可以在设备上运行。

#2


0  

According to the documentation, iTunes affiliate links have to process several redirects in order to wind up in iTunes. Follow the example to create an NSURLConnection, set yourself as its delegate, and use the string it ends up with to open with UIApplication.

根据文档,iTunes联盟链接必须处理几个重定向,以便在iTunes中结束。按照示例创建NSURLConnection,将自己设置为其委托,并使用最终的字符串打开UIApplication。