ios - 了解 SKStoreReviewController 何时被解雇

标签 ios swift swift4 skstorereviewcontroller

调用SKStoreReviewController.requestReview()后,会出现一个弹出窗口。

当用户点击任何选项时,我如何知道弹出窗口已关闭?

最佳答案

无法直接找到有关 SKStoreReviewController 的任何信息。直接

following post explains有关如何呈现 View 的更多信息,可能会帮助您理解原因。

但是,我不喜欢这个答案,因此我测试了您的评论的变体,并能够准确确定屏幕何时关闭。

以下是一个非常简单的应用程序,说明了这一点:

import UIKit
import StoreKit

class ViewController: UIViewController {
    @IBOutlet weak var testView: TestView!

    override func viewDidLoad() {
        super.viewDidLoad()

        testView.isUserInteractionEnabled = false
    }

    @IBAction func submit(_ sender: UIButton) {
        testView.isUserInteractionEnabled = true
        SKStoreReviewController.requestReview()
    }
}

class TestView: UIView {
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)

        print("touch")
    }
}

这里发生的事情是我的主屏幕上有一个 View ,只能在显示提示后才能与之交互。您当然应该清理它,以便它在第一次成功后停止接收输入,但这确实会通知我请求被驳回后与应用程序的用户交互。

关于ios - 了解 SKStoreReviewController 何时被解雇,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46793479/

相关文章:

iphone - __weak UIDataType *weakSelf 和 UIDataType __weak *weakSelf 之间的区别?

ios - UITableView 行在 UITableViewHeaderSection 下滑动

swift - UIStackView 调整我的 View 大小

arrays - Swift 4 - FlatMap 不会展平数组

ios - 是否可以更改状态栏高度/y 位置?

ios - 快速绘制圆弧时的额外线条

ios - GLES2着色器的高精度输出

swift - 延迟 1 秒后或在调度异步中如何发布通知?

cocoa - NSWindow 打开,但按钮不起作用,并且我无法创建 IBOutlet

ios - NSObjectInaccessibleException',原因 : 'CoreData could not fulfill a fault