ios应用内跳转到appstore里评分

在ios6.0前跳转到appstore评分一般是直接跳转到appstore评分
NSString *evaluateString = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=587767923"];
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:evaluateString]];

在ios6.0,APPle增加了一个心得功能,当用户需要给APP评分时候,不再跳转到appstore了,可以在应用内实现打开appstore,苹果提供了一个框架StoreKit.framework,实现步骤如下:
   1:导入StoreKit.framework,在需要跳转的控制器里面添加头文件#import
   2:实现代理SKStoreProductViewContro llerDelegate
   3:- (void)evaluate{
     
       //初始化控制器
       SKStoreProductViewContro ller *storeProductViewContorll er = [[SKStoreProductViewContro ller alloc] init];
       //设置代理请求为当前控制器本身
       storeProductViewContorll er.delegate = self;
       //加载一个新的视图展示
       [storeProductViewContorll er loadProductWithParameter s:
         //appId唯一的
         @{SKStoreProductParameterI TunesItemIdentifier : @"587767923"} completionBlock:^(BOOL result, NSError *error) {
                 //block回调
               if(error){
                       NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
               }else{
                       //模态弹出appstore
                       [self presentViewController:storeProductViewContorll er animated:YES completion:^{
                             
                       }
                         ];
               }
       }];
}

//取消按钮监听
- (void)productViewControllerDid Finish:(SKStoreProductViewContro ller *)viewController{
       [self dismissViewControllerAni mated:YES completion:^{
             
       }];
}
就很轻松实现了应用内置appstore评分功能。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值