StoreKit

1.提示去App Store升级APP:

    override func touchesBegan(_ touches: Set, with event: UIEvent?) {
        if #available(iOS 11, *) {//@available(iOS 6.0, *)
            let store = SKStoreProductViewController()
            store.delegate = self
            store.loadProduct(withParameters: [SKStoreProductParameterITunesItemIdentifier: 1193923530]) { (_, error) in
                guard  error == nil else {
                    return
                }
                self.present(store, animated: true, completion: nil)
            }
        } else {
            let url = URL(string: "https://itunes.apple.com/cn/app/id1193923530")!
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }
    }

2.一句代码实现评论

SKStoreReviewController.requestReview()

注意:365天内只能弹出3次,需要把握时机的使用.

image.png

image.png

你可能感兴趣的:(StoreKit)