我想知道是否可以将我的用户从我的应用程序内直接带到应用程序商店中我的应用程序的评论部分?
我不希望它在 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"]];
但是,点击它似乎打开了 iTunes 应用程序而不是应用程序商店,然后只是给出一个错误提示“无法连接到商店。无法建立安全连接”。
有什么想法吗?
最佳答案
在 iOS 7.0 中似乎有一个值得一提的问题,如所述 here .你可以在他们的源代码中看到 Appirator 如何处理这个问题 here .
基本上,您需要以不同方式处理 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]];
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]];
来源:Appirator
2017 年 11 月 14 日更新
从 iOS 10.3 开始,我们可以使用 SKStoreReviewController 请求审核,它实际上会在您的应用中打开一个整洁的小弹出窗口,而不是离开您的应用:
if (@available(iOS 10.3, *)) {
[SKStoreReviewController requestReview];
return;
}
关于iphone - 打开 App Store 以在我的应用程序中评分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7498846/