- 應用內評分
- 跳轉AppStore及評分評論功能
1.應用內評分
#import <StoreKit/StoreKit.h>
[SKStoreReviewController requestReview];
一行代碼搞定!
SKStoreReviewController是iOS 10.3新增的API朴读。
系統(tǒng)自動處理整個過程,出現(xiàn)次數(shù)決定于系統(tǒng)策略捍靠。
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中加上參數(shù)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的系統(tǒng)使用該方法
-(void)openURL: options: completionHandler: 是iOS 10.0中新增方法谊迄,iOS 10.0及以上的系統(tǒng)使用該方法
參考:
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~愿您有所收獲