Swift -- appStore评分

  • 应用外跳转
UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/cn/app/wechat/id836500024?mt=12")!)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/cn/app/wechat/id836500024?mt=12"]];  
  • 应用内跳转
private func jumpStoreScore() {
   let storeCtrlr = SKStoreProductViewController()
   storeCtrlr.delegate = self
   storeCtrlr.loadProduct(withParameters: [SKStoreProductParameterITunesItemIdentifier: "836500024"]) { [weak self] (isSuccess, error) in
       if isSuccess {
           self?.present(storeCtrlr, animated: true, completion: {
           })
       }else {
           print("error:\(String(describing: error))")
       }
   }
}
func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
        dismiss(animated: true) { 
            print("取消 productViewControllerDidFinish")
        }
}
- (void)jumpStoreScore {
    SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
    storeProductViewContorller.delegate=self;
    [storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"836500024"} completionBlock:^(BOOLresult,NSError*error) {
        if(error) {
            NSLog(@"error %@ with userInfo %@",error,[erroruserInfo]);
        }else{
            [self presentViewController: storeProductViewContorller animated:YES completion: nil];
        }
    }];
}

//AppStore取消按钮监听
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
    [self dismissViewControllerAnimated:YES completion:nil];
}

使用应用外的方式可以实现进入AppStore页面
使用应用外跳转就是调不起来,提示:

2017-06-21 16:23:26.787090+0800 xxxx[3308:202712] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/xx/Library/Developer/CoreSimulator/Devices/17CBA861-06CE-40AF-BDDF-88A5A087AF04/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-06-21 16:23:26.788148+0800 xxxx[3308:202712] [MC] Reading from private effective user settings.

好像也没什么权限问题设置的,调不起来也不知道咋回事。。先放着吧,要用的时候在调

参考:iOS 应用跳转到AppStore评分 可内置跳转

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 178,030评论 25 709
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 14,689评论 4 61
  • ⒏推理 “事情怎么样了?” “起初很成功,但是后来出现了一个叫林晓峰的人,他很聪明,识...
    叶凌凡阅读 462评论 0 3
  • 我的邻居尚姨是个非常热心的老太太,一共生了两个儿子和三个女儿,唐山大地震时老伴和一个老闺女遇难…… 那个年代孩子多...
    海迪哲lshj阅读 307评论 2 2

友情链接更多精彩内容