简体   繁体   English

在应用商店中打开iTunes链接?

[英]Open itune link in app store?

My application is in 3 languages, i want to open app store on button click and link is my another application. 我的应用程序使用3种语言,我想单击按钮打开应用程序商店,而链接是我的另一个应用程序。 But when i am sending link to app store , its always opening US market with English description. 但是,当我向应用程序商店发送链接时,它总是用英语描述打开美国市场。 when i am using browser its going correct. 当我使用浏览器时,它会正确运行。 Where i am going wrong. 我要去哪里错了。

-(IBAction)Button_us_itune:(id)sender{
    NSString *ituneLink =@"https://itunes.apple.com/us/app/My_application/AppID?mt=8&ign-mpt=uo%3D4";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ituneLink]];

}
-(IBAction)Button_fr_itune:(id)sender{
    NSString *ituneLink =@"https://itunes.apple.com/fr/app/My_application/AppID?mt=8&ign-mpt=uo%3D4";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ituneLink]];
}
-(IBAction)Button_du_itune:(id)sender{
    NSString *ituneLink =@"https://itunes.apple.com/de/app/My_application/AppID?mt=8&ign-mpt=uo%3D4";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ituneLink]];
}

这可能是因为您正在使用/已登录美国商店。

Actually it's pretty easy. 其实很简单。 You have two mistakes: 您有两个错误:

  1. You are using country code in the links. 您在链接中使用国家代码。 ie you are mention exactly what store you want to open. 也就是说,您确切地提到了要开设的商店。 This is bad because on some cases the user would open different store than the one you need. 这很糟糕,因为在某些情况下,用户将打开与所需商店不同的商店。 If you ask for US and user registered for another one you would lose him. 如果您要求美国,而用户又注册了一个,则您将失去他。

  2. You probably can't tell which store the user is register to. 您可能无法确定用户要注册到哪个商店。 So even if you create the the right link you can never tell which function to call (there is no API to know where the user is registered according to my knowledge - you can just know where he is or his language settings). 因此,即使您创建了正确的链接,您也永远不会知道要调用哪个函数(根据我的知识,没有API可以知道用户在哪里注册-您只能知道他在哪里或他的语言设置)。

So, You could just remove the country code. 因此,您可以删除国家/地区代码。 ie: 即:

NSString *ituneLink =@"https://itunes.apple.com/app/My_application/AppID?mt=8&ign-mpt=uo%3D4"

But even then you would probably have problems with the link itself on some cases and in some OS versions . 但是即使那样,在某些情况下和某些OS版本中,链接本身也可能会出现问题

I suggest you use a simple library called iLink that would figure out everything (at run time) and create the link you need that would work always. 我建议您使用一个名为iLink的简单库,该库可以找出所有内容(在运行时)并创建需要的链接,该链接将始终有效。 It also have a great feature that would prompt the user for an update if there is one on the store. 它还具有一项很棒的功能,如果商店中有更新,则会提示用户进行更新。

You are giving denmark app link. 您正在提供丹麦应用程序链接。 And I think you are logged in with other country. 而且我认为您已在其他国家/地区登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM