iOS 诱导用户评论

demo: http://www.cocoachina.com/ios/20160517/16299.html

第一种:跳转到Appstore打开评分

NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?action=write-review", KAPPID];
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:str]];

  

第二种:APP内部打开页面跳转到评分 

  /*
     >>>>>苹果IOS6.0提供了一个框架StoreKit.framework,
     1.导入StoreKit.framework,
     2.在需要跳转的控制器里面添加头文件 #import <StoreKit/StoreKit.h>,
     3.实现代理方法:< SKStorePRoductViewControllerDelegate >
     */

 SKStoreProductViewController *storeProductViewController;

 [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:KAPPID} completionBlock:^(BOOL result, NSError * _Nullable error) {
        
        if (error)
            DLog(@"error %@ with userInfo %@",error,[error userInfo]);
        else
            [self presentViewController:storeProductViewController animated:YES completion:nil];
    }];



//Appstore 取消按钮的回调
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
    [storeProductViewController dismissViewControllerAnimated:YES completion:nil];
}

  

第三种:APP内打开评分弹框(IOS10.3之后的方法)

  //   导入StoreKit.framework,#import "Availability.h"(用于判断 ios 版本)

  if (__IPHONE_10_3)
        //一句话实现在App内直接评论了。然而需要注意的是:打开次数一年不能多于3次。(当然开发期间可以无限制弹出,方便测试)
        [SKStoreReviewController requestReview];
    else
        [JDMessageView showMessage:@"版本不支持此方法"];
    

  

  

原文地址:https://www.cnblogs.com/saytome/p/8607429.html