美文网首页
iOS swift 去appStore 下载和评分

iOS swift 去appStore 下载和评分

作者: 秋叶红90 | 来源:发表于2021-05-25 19:29 被阅读0次

应用外部

let appID = ""
            if let url = URL.init(string: "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=\(appID)&pageNumber=0&sortOrdering=2&mt=8") {
                UIApplication.shared.open(url, options: [:], completionHandler: nil)
            }
/// 打开应用详情
          // "itms-apps://itunes.apple.com/app/id\(appID)"

应用内部

SKStoreReviewController.requestReview()

应用内部打开下载页面

let toVC = SKStoreProductViewController.init()
        toVC.delegate = self
        let kAppId = ""
        let keyD = [SKStoreProductParameterITunesItemIdentifier:kAppId]
        toVC.loadProduct(withParameters: keyD) {  [weak self](falg, error) in
            if error == nil {
                self?.present(toVC, animated: true, completion: nil)
            }
        }

代理实现 SKStoreProductViewControllerDelegate

 func productViewControllerDidFinish(_ viewController: SKStoreProductViewController){
        self.dismiss(animated: true, completion: nil)
    }

相关文章

网友评论

      本文标题:iOS swift 去appStore 下载和评分

      本文链接:https://www.haomeiwen.com/subject/mupcsltx.html