iOS 跳转App Store 评论、评分

  • 时间:2019-06-11 02:51 作者:BeeQiang 来源:BeeQiang 阅读:703
  • 扫一扫,手机访问
摘要:1、跳转到App Store 直接编辑评论 NSString *APPID = @"xxxxxxxx";//app ID NSString *nsStringToOpen = [NSString stringWithFormat: @"itms apps:

1、跳转到App Store 直接编辑评论

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

2、app内部直接评分

if (@available(iOS 10.3, *)) {        if([SKStoreReviewController respondsToSelector:@selector(requestReview)]) {            //防止键盘遮挡            [[UIApplication sharedApplication].keyWindow endEditing:YES];            [SKStoreReviewController requestReview];                    }    }else {    // Fallback on earlier versions}

3、跳转到某app下载页面 一般用与打广告

//第一种方式    NSString *appId = @"983122949";    // 创立对象    SKStoreProductViewController *storeVC = [[SKStoreProductViewController alloc] init];    // 设置代理商    storeVC.delegate = self;    // 初始化参数    NSDictionary *dict = [NSDictionary dictionaryWithObject:appId forKey:SKStoreProductParameterITunesItemIdentifier];    // 跳转App Store页    [storeVC loadProductWithParameters:dict completionBlock:^(BOOL result, NSError * _Nullable error) {        if (error) {            NSLog(@"错误信息:%@",error.userInfo);        }else{            // 弹出模态视图            [self presentViewController:storeVC animated:YES completion:nil];        }    }];//第二种方式    Class allow = NSClassFromString(@"SKStoreProductViewController");    if (allow != nil && ![[UIDevice currentDevice].model isEqualToString:@"iPhone Simulator"]) {        NSLog(@"loading");        SKStoreProductViewController *product = [[SKStoreProductViewController alloc] init];        product.delegate = self;        [product loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"983122949"} completionBlock:^(BOOL result, NSError * _Nullable error) {            NSLog(@"completion");            NSLog(@"--%d-%@",result,error);            if (!error) {                [self presentViewController:product animated:YES completion:nil];            }else{                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];            }        }];    }#pragma mark -- SKStoreProductViewControllerDelegate/** SKStoreProductViewControllerDelegate 方法,选择完成之后的解决 @param viewController SKStoreProductViewController */- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{    NSLog(@"将要退出 App Store 页面了");    [viewController dismissViewControllerAnimated:YES completion:^{        NSLog(@"已经退出 App Store 页面完成了");    }];}

4、跳转评论

在iOS 11之前,为了让客户直接跳到App Store的评论页面,你的代码大概是这样写的:

-(void)goToAppStore{    NSString *itunesurl = @"[http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=XXXXXXXX&pageNumber=0&sortOrdering=2&type=Purple](https://links.jianshu.com/go?to=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewContentsUserReviews%3Fid%3DXXXXXXXX%26pageNumber%3D0%26sortOrdering%3D2%26type%3DPurple)+Software&mt=8";    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:itunesurl]];}

在iOS 11上不灵了,直接提醒“无法连接App Store”!

我试了一下,果然如此,顺便看了一下其余家的APP,不少大厂的APP也掉进了这个坑里还没爬出来,比方饿了么,百度外卖等。经过搜索引擎的帮助,我找到了如下办法:

-(void)goToAppStore{    NSString *itunesurl = @"itms-[apps://itunes.apple.com/cn/app/idXXXXXX?mt=8&action=write-review](https://links.jianshu.com/go?to=apps%3A%2F%2Fitunes.apple.com%2Fcn%2Fapp%2FidXXXXXX%3Fmt%3D8%26action%3Dwrite-review)";    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:itunesurl]];}

注意:把里面的XXX替换成你自己的APP ID。 假如不知道 APP ID,打包到appstore 的时候有APP ID

iOS 11 跳转到app设置

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];[[UIApplication sharedApplication]openURL:url];

如何阅读苹果开发文档

  • 全部评论(0)
最新发布的资讯信息
【系统环境|】2025含金量排名前十计算机专业证书(2025-10-15 20:51)
【系统环境|】你有白帽众测 我有黑帽雇佣(2025-10-15 20:50)
【系统环境|】印度理工学院成功开发出针对5G网络攻击的最新软件解决方案(2025-10-15 20:49)
【系统环境|】道德黑客与黑客教程(2025-10-15 20:49)
【系统环境|】苹果翻车!macOS 15 竟藏“后门”,黑客能直接偷你所有密码(2025-10-15 20:47)
【系统环境|】解密“被墙”玄学:为什么我的网络方案能做到长期稳定?(2025-10-15 20:46)
【系统环境|】NAS软路由/防火墙/网络安全需要注意哪些?如何保护你的网络设备(2025-10-15 20:45)
【系统环境|】你真的理解防火墙吗?(2025-10-15 20:44)
【系统环境|】苹果手机一键换机教程详解(2025-10-15 20:44)
【系统环境|】二手iPhone到手后怎么快速验机?(2025-10-15 20:43)
手机二维码手机访问领取大礼包
返回顶部