iOS 应用商店评分StoreReview
2019-05-15 本文已影响1人
72行代码
导入头文件#import <StoreKit/StoreKit.h>
+ (void)yoStoreReview{
if (@available(iOS 10.3, *)) {
if ([SKStoreReviewController respondsToSelector:@selector(requestReview)]){
//防止键盘遮挡
[[UIApplication sharedApplication].keyWindow endEditing:YES];
// iOS10.3+ 直接在App内弹出评分框
// 此方式苹果允许的调用频率为3次/年
[SKStoreReviewController requestReview];
}
} else {
// <iOS10.3 跳转AppStore的评论页面
NSString *appIDStr = [NSString stringWithFormat:@"%@", [YostarUtilits getUserDefaultsForKey:@"APPLEID"]];
NSString *appStoreReviewStr = [NSString stringWithFormat:@"https://itunes.apple.com/app/id%@?action=write-review", appIDStr];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreReviewStr]];
}
}