mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-24 20:00:37 +00:00
55 lines
2.6 KiB
Markdown
55 lines
2.6 KiB
Markdown
# App 评分
|
||
|
||
> 经常有这样的需求-引导用户在合适的时机对 App 做出好评。本文就尝试谈一谈这一块的一些知识
|
||
|
||
1. 评分的方式
|
||
可以跳出应用对 App 进行评分,也可以在应用内进行评分(>= iOS 10.3)。
|
||
|
||
2. 跳出 App 评分
|
||
利用系统方法打开 URL(跳到 App store 后跳转到自己 App 的评价页面)
|
||
```
|
||
NSString *urlString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?action=write-review", @"你的App ID"];
|
||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
|
||
```
|
||
|
||
3. 应用内评分
|
||
iOS 10.3 之后系统为我们评分这个需求引入 **StoreKit**。利用它,我们可以很方便地在应用内对 App 进行快速评分,而不用跳出去。
|
||
+ 在 App 内部打开 App store并跳转到App 评价页面
|
||
```
|
||
#import <StoreKit/StoreKit.h>
|
||
SKStoreProductViewController *storeVC = [[SKStoreProductViewController alloc] init];
|
||
storeVC.delegate = self;
|
||
[storeVC loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"1401834682"} completionBlock:^(BOOL result, NSError * _Nullable error) {
|
||
if (error) {
|
||
|
||
}else{
|
||
[self presentViewController:storeVC animated:YES completion:nil];
|
||
}
|
||
}];
|
||
```
|
||
+ 在 App 内弹出评分对话框,用户星级评分后可以继续输入文字
|
||
```
|
||
if (@available(iOS 10.3, *)) {
|
||
if([SKStoreReviewController respondsToSelector:@selector(requestReview)]){
|
||
[SKStoreReviewController requestReview];
|
||
else{
|
||
NSString *urlString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?action=write-review", @"你的App ID"];
|
||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
|
||
}
|
||
}else {
|
||
// Fallback on earlier versions
|
||
NSString *urlString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?action=write-review", @"你的App ID"];
|
||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
|
||
}
|
||
```
|
||
|
||
4. 注意时机哦
|
||
我们的目的是能得到用户的正反馈,如果在用户刚使用APP时就弹出评分框,可能会给某些用户带来反感,因此,选择一个合适的时机弹出评分很重要,不然适得其反。
|
||
今天在使用爱奇艺的时候发现他们的弹出场景是这样的。我因为要出门所以下载了一部电影。在会员模式下高速缓存成功后(我很满意)弹出评分按钮。
|
||

|
||
|
||
|
||
|
||
|
||
|
||
|