我正在创造自己的iPhone游戏的免费版本。我想在免费版本中添加一个按钮,引导用户进入应用商店中的付费版本。如果我使用标准链接

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8

iPhone首先打开Safari,然后打开应用商店。我使用过其他直接打开应用程序商店的应用程序,所以我知道这是可能的。

什么好主意吗?应用商店的URL方案是什么?


当前回答

只需在应用程序链接中将“itunes”改为“phobos”即可。

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8

现在它会直接打开应用商店

其他回答

我认为苹果已经为应用程序链接提供了一个新的链接: https://apps.apple.com/app/id1445530088或https://apps.apple.com/app/ {your_app_id}

它会直接打开应用商店

NSString *iTunesLink = @"itms-apps://itunes.apple.com/app/ebl- 
skybanking/id1171655193?mt=8";

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];

这对我来说非常有效,只使用APP ID:

 NSString *urlString = [NSString stringWithFormat:@"http://itunes.apple.com/app/id%@",YOUR_APP_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

重定向的数量为0。

当支持多个操作系统和平台时,创建链接可能会成为一个复杂的问题。例如,在iOS 7上不支持WebObjects(其中一些),你创建的一些链接会打开另一个国家的商店,然后用户的等等。

有一个叫做iLink的开源库可以帮助你。

There advantages of this library is that the links would be found and created at run time (the library would check the app ID and the OS it is running on and would figure out what link should be created). The best point in this is that you don't need to configure almost anything before using it so that is error free and would work always. That's great also if you have few targets on same project so you don't have to remember which app ID or link to use. This library also would prompt the user to upgrade the app if there is a new version on the store (this is built in and you turn this off by a simple flag) directly pointing to the upgrade page for the app if user agrees.

复制两个库文件到你的项目(iLink.h & iLink.m)。

在你的appDelegate.m上:

#import "iLink.h"

+ (void)initialize
{
    //configure iLink
    [iLink sharedInstance].globalPromptForUpdate = YES; // If you want iLink to prompt user to update when the app is old.
}

例如,在你想打开评级页面的地方,只需使用:

[[iLink sharedInstance] iLinkOpenAppPageInAppStoreWithAppleID: YOUR_PAID_APP_APPLE_ID]; // You should find YOUR_PAID_APP_APPLE_ID from iTunes Connect 

不要忘记在同一个文件中导入iLink.h。

这里有一个很好的整个库的文档还有一个iPhone和Mac的示例项目。

至少iOS 9及以上版本

直接在App Store打开

一个应用程序

itms-apps://itunes.apple.com/app/[appName]/[appID]

开发者的应用程序列表

itms-apps://itunes.apple.com/developer/[developerName]/[developerID]