iOS跳转AppStore进⾏评分
iOS 跳转App Store进⾏评分
1.前⾔
遭遇4.2.2把我逼得没办法了,啥功能都怼上去了
2.实现
在 viewdidload 或者 viewwillappear 中判断是否需要显⽰评分,因为SKStoreReviewController ⼀年最多三次,所以我就⽆耻点相隔四个⽉调⽤⼀次
NSDate *oldTime = [[NSUserDefaults standardUserDefaults]objectForKey:@"storeStarTime"];
莫等闲下一句if (oldTime) {
//利⽤NSCalendar⽐较⽇期的差异
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit unit = NSCalendarUnitMonth;//只⽐较⽉数差异怎样学白话
//⽐较的结果是NSDateComponents类对象
NSDateComponents *delta = [calendar components:unit fromDate:oldTime toDate:[NSDate date] options:0];
夜华和墨渊什么关系if (h >= 4) {
[self showStore];
}
}else{
[[NSUserDefaults standardUserDefaults]setObject:[NSDate date] forKey:@"storeStarTime"];
}
唤起评分页
-(void)showStore{
if (@available(iOS 10.3, *)) {
优秀共青团员申报材料if([SKStoreReviewController respondsToSelector:@selector(requestReview)]) {// iOS 10.3 以上⽀持
//防⽌键盘遮挡
[[UIApplication sharedApplication].keyWindow endEditing:YES];
眼睛疼痛[SKStoreReviewController requestReview];
}else{
NSString * nsStringToOpen = [NSString stringWithFormat: @"itms-apps://itunes.apple/app/id%@?action=write-review",@"1573880428"];//替换为对应的APPID
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:nsStringToOpen] options:@{} completionHandler:^(BOOL success) {
}];
}
} else {
NSString * nsStringToOpen = [NSString stringWithFormat: @"itms-apps://itunes.apple/app/id%@?action=write-review",@"1573880428"];//替换为对应的APPID
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:nsStringToOpen] options:@{} completionHandler:^(BOOL success) {
}];
}
[[NSUserDefaults standardUserDefaults]setObject:[NSDate date] forKey:@"storeStarTime"];
}
附上APP地址: 有想看⼩说的⼩伙伴可以试下 ⽀持换源 ⽀持⾃定义书源
>红枫种子
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论