ios开发之app内启动用户评价

来源:互联网 发布:淘宝网注册开店 编辑:程序博客网 时间:2024/04/28 22:13

恰当的指引用户去给app评分是获得用户反馈的一种不错的途径。


“通过custom url scheme启动应用程序”这篇文章里讲了通过url启动地图、邮件等程序,当然也可以通过url启动AppStore中软件的用户评价界面。

NSString *url = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",490062954];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

490062954是程序的Apple ID,可以在iTunes Connect中查到。


比如在用户使用一段时间后,弹出一个对话框提醒用户去评价:

NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"去给'%@'打分吧!",appName]
                                                        message:@"您的评价对我们很重要"
                                                       delegate:self
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"稍后评价",@"去评价",nil];
[alertView show];

[alertView release];

在点击“去评价”按钮时就可以使用上面的方法打开用户评价的url。


我在对话框中通过传递appName这个参数显示了软件名称,当然也可以显示其他软件信息,比如软件版本:

NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; “CFBundleDisplayName”和“CFBundleVersion”都是info.plist文件中的key。
0 0
原创粉丝点击