- 应用内评分
- 跳转AppStore及评分评论功能
1.应用内评分
#import <StoreKit/StoreKit.h>
[SKStoreReviewController requestReview];
一行代码搞定!
SKStoreReviewController是iOS 10.3新增的API。
系统自动处理整个过程,出现次数决定于系统策略。
2.跳转AppStore及评分评论功能
(1)跳转AppStore
- 方法1: 使用SKStoreProductViewController
#import <StoreKit/StoreKit.h>
SKStoreProductViewController *productVC = [[SKStoreProductViewController alloc] init];
productVC.delegate = self;
[productVC loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@(1188192874)} completionBlock:^(BOOL result, NSError * _Nullable error) {
[self presentViewController:productVC animated:YES completion:nil];
}];
#pragma mark - SKStoreProductViewControllerDelegate
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
-
方法2: 使用Application
NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/cn/app/%E6%9D%A5%E4%BD%8F%E5%90%A7/id1188192874?mt=8"]; [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { // if success }];
App在AppStore中的URL获取:
1.在您的电脑上启动iTunes。
2.搜索要链接的项目。
3.在iTunes中右键单击或单击该项目的名称,然后从弹出菜单中选择“复制链接”。
(2)跳转AppStore评分评论
在url中加上参数action=write-review
NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/cn/app/%E6%9D%A5%E4%BD%8F%E5%90%A7/id1188192874?mt=8&action=write-review"];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
// if success
}];
注意:
-(BOOL)openURL: 在iOS 10.0中已弃用,低于iOS 10.0的系统使用该方法
-(void)openURL: options: completionHandler: 是iOS 10.0中新增方法,iOS 10.0及以上的系统使用该方法
参考:
https://developer.apple.com/ios/human-interface-guidelines/interaction/ratings-and-reviews/
https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS10_3.html#//apple_ref/doc/uid/TP40017594-SW1
https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview?language=objc
https://developer.apple.com/library/content/qa/qa1629/_index.html
end~愿您有所收获
网友评论