源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

iOS中在APP内加入AppStore评分功能的实现方法

  • 时间:2020-12-07 15:07 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:iOS中在APP内加入AppStore评分功能的实现方法
iOS应用内部实现App Store评分功能,笔着整理总结有三种方式,各位可根据自己需求自己选择。先介绍下评分功能实现的三种方式。 1,通用方式通过App内部打开网页形式,跳转到AppStore编辑评论,可评分,可评论。 优点:方便,快捷,不受系统版本限制,目前最常用的方式。 缺点:内部网页形式加载缓慢,等待时间长,加载失败概率大。 2,iOS 6.0以后 在app内部加载AppStore 展示app信息 优点:展示速度比方法三块快 缺点:不能直接跳转到评论编辑页面,需要手动点击评论+编辑评论 3,iOS 10.0.3 新增应用内评分功能,调用系统方法评分。 优点:无须跳转,应用内系统弹框,方便快速。 缺点:只能评分,且一年只能使用三次弹框。 [b]开发步骤:[/b] 导入头文件 #import 1,iOS 10.0.3以后调用系统弹框评分 [img]http://files.jb51.net/file_images/article/201711/201711081101218.png[/img]
/** 
 * 只能评分,不能编写评论 
 * 有次数限制,一年只能使用三次 
 * 使用次数超限后,需要跳转appstore 
 */ 
- (IBAction)systemComentBtnAction:(UIButton *)sender { 
if([SKStoreReviewController respondsToSelector:@selector(requestReview)]) {// iOS 10.3 以上支持 
 //防止键盘遮挡 
 [[UIApplication sharedApplication].keyWindow endEditing:YES]; 
 [SKStoreReviewController requestReview]; 
} 
} 
2,跳转到AppStore对应应用评论页面 [img]http://files.jb51.net/file_images/article/201711/201711081101229.png[/img]
/** 
 * 可评分评论,无次数限制 
 */ 
- (IBAction)appStoreComentBtnAction:(UIButton *)sender { 
NSString * nsStringToOpen = [NSString stringWithFormat: @"itms-apps://itunes.apple.com/app/id%@?action=write-review",@"AppID"];//替换为对应的APPID 
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:nsStringToOpen]]; 
} 
3,iOS 6.0以后的方法,内部加载AppStore [img]http://files.jb51.net/file_images/article/201711/2017110811012210.png[/img] 注:需签署代理
/** 
 * 在APP内部加载App Store 展示APP信息,但不能直接跳转到评论编辑页面。 
 * 再加载处App Store展示页面后,需要手动点击 评论→ 撰写评论 
 */ 
- (IBAction)webAppStoreBtnAction:(UIButton *)sender { 
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init]; 
storeProductViewContorller.delegate = self; 
//加载App Store视图展示 
[storeProductViewContorller loadProductWithParameters: 
 @{SKStoreProductParameterITunesItemIdentifier : @"APPID"} completionBlock:^(BOOL result, NSError *error) { 
  if(error) { 
  } else { 
   //模态弹出appstore 
   [self presentViewController:storeProductViewContorller animated:YES completion:^{ 
   }]; 
  } 
 }]; 
} 
// 代理方法 
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController { 
[self dismissViewControllerAnimated:YES completion:^{ 
}]; 
} 
[b]总结[/b] 以上所述是小编给大家介绍的iOS中在APP内加入AppStore评分功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程素材网网站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部