您的位置:首页 > 移动开发

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

2016-02-26 09:20 477 查看
恰当的指引用户去给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,可以在

中查到。

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

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: