打开App Store以从我的应用程序中评分

Pau*_*ris 8 iphone xcode objective-c app-store

我想知道是否可以从我的应用程序中将我的用户直接带到应用程序商店的应用程序的评论部分?

我不想在Safari中打开它,我希望它直接在设备上打开App Store应用程序并将它们带到评论页面.

我试过以下几点;

[[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"]];
Run Code Online (Sandbox Code Playgroud)

但是,点击它似乎打开iTunes应用程序而不是应用商店,然后只是出现错误,说"无法连接到商店.无法建立安全连接".

有任何想法吗?

Cra*_*itt 24

似乎是值得的描述中的iOS 7.0提一个问题在这里.您可以在此处查看Appirator如何在其源代码中处理问题.

基本上,您需要以不同方式处理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]];
Run Code Online (Sandbox Code Playgroud)

2015年8月19日更新

上面的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]];
Run Code Online (Sandbox Code Playgroud)

来源:Appirator


2017年11月14日更新

从iOS 10.3开始,我们可以使用SKStoreReviewController请求审核,它实际上会在您的应用中打开一个整洁的小popover,而不是导航离开您的应用:

if (@available(iOS 10.3, *)) {
  [SKStoreReviewController requestReview];
  return;
}
Run Code Online (Sandbox Code Playgroud)


You*_*sef 18

本博客所示:

- (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]];
}
Run Code Online (Sandbox Code Playgroud)