xcode 在我的应用程序中打开 App Store 进行评分
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7498846/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening up App Store to Rate from within my App
提问by Paul Morris
I was wondering if it is possible to take my user directly to the review section of my app on the app store from within my app?
我想知道是否可以从我的应用程序中将我的用户直接带到应用程序商店中我的应用程序的评论部分?
I don't want this to open in Safari, I want it to directly open the App Store app on the device and take them to the review page.
我不希望它在 Safari 中打开,我希望它直接打开设备上的 App Store 应用程序并将它们带到评论页面。
I have tried the following;
我尝试了以下方法;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=437688779&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"]];
However, clicking that seems to open up the iTunes app and not app store and then just gives an error saying "Cannot Connect to the store. A secure connection could not be established".
但是,单击该按钮似乎会打开 iTunes 应用程序而不是应用程序商店,然后只会显示“无法连接到商店。无法建立安全连接”的错误。
Any ideas?
有任何想法吗?
回答by Craig Grummitt
There seems to be an issue worth mentioning in iOS 7.0 as described here. You can see how Appirator dealt with the problem in their source here.
似乎有一个问题值得描述iOS中7.0提这里。您可以在此处查看 Appirator 如何在其来源中处理问题。
Basically, you need to handle 7.0 users differently, as so: (the first line is the same as the accepted solution, the appended strings are just on the same line.)
基本上,您需要以不同方式处理 7.0 用户,因此:(第一行与接受的解决方案相同,附加的字符串仅在同一行上。)
NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=yourAppIDHere";
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
str = @"itms-apps://itunes.apple.com/app/idyourAppIDHere";
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
Update 19 August 2015
2015 年 8 月 19 日更新
The URLs above don't work for iOS 8.0. Updated code catering for all iOS versions would be:
上述 URL 不适用于 iOS 8.0。适用于所有 iOS 版本的更新代码如下:
NSString *str;
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
if (ver >= 7.0 && ver < 7.1) {
str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@",appID];
} else if (ver >= 8.0) {
str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%@&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software",appID];
} else {
str = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@",appID];
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
Source: Appirator
来源:Appirator
Update 14 November 2017
2017 年 11 月 14 日更新
From iOS 10.3, we can request a review using the SKStoreReviewController, which actually opens a neat little popover in your app rather than navigating away from your app:
从 iOS 10.3 开始,我们可以使用SKStoreReviewController请求评论,它实际上会在您的应用程序中打开一个整洁的小弹出窗口,而不是离开您的应用程序:
if (@available(iOS 10.3, *)) {
[SKStoreReviewController requestReview];
return;
}
回答by Youssef
As seen in this blog:
- (IBAction)gotoReviews:(id)sender
{
NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str];
str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];
// Here is the app id from itunesconnect
str = [NSString stringWithFormat:@"%@yourAppIDHere", str];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
回答by P?l Brattberg
回答by Vishnu R Kaimal
Use this:- @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@";
用这个:- @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@";
回答by Anup Gupta
use this its also help you.
使用它也可以帮助您。
NSString *fdAppUrl=@"itms://itunes.apple.com/us/app/apple-store/id1137341185?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:fdAppUrl]];
http://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store
http://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store