是否可以确定SKStore Review Controller是否已经出现。
我的意图是要么显示SKStore审查控制器(如果适用),要么显示我自己的反馈控制器,并将用户redirect到App Store。 通过这样做,我可以避免不止一次询问用户的反馈。
在阅读苹果在SKStore Review Controller( https://developer.apple.com/reference/storekit/skstorereviewcontroller )上缺less的文档之后,似乎没有办法确定SKStore Review Controller目前是否已经呈现或已经呈现先前。
我知道我可以将显示频率存储在NSUserDefaults中,但我宁愿避免这样做。
这是我如何检测,如果它已经提交。
private static func checkIfShownSKStoreReviewController(_ iteration: Int, originalWindowCount: Int) { let windows = UIApplication.shared.windows if windows.count > originalWindowCount { let window = windows[1] if window.className == "UITextEffectsWindow" || window.className == "UIRemoteKeyboardWindow" { print("Shown SKVC iteration: \(iteration)") //Do logic stuff like saving to your database return } } if iteration > 2000 { print("checkIfShownSKStoreReviewController: timeout, bailing \(iteration)") return } runThisAfterDelay(seconds: 0.02, after: { checkIfShownSKStoreReviewController(iteration + 1, originalWindowCount: originalWindowCount) }) } private static func runThisAfterDelay(seconds seconds: Double, after: () -> ()) { let time = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))) dispatch_after(time, dispatch_get_main_queue(), after) } static func showReview() { print("Showing AppStore Review") if #available(iOS 10.3, *) { SKStoreReviewController.requestReview() checkIfShownSKStoreReviewController(0, originalWindowCount: UIApplication.shared.windows.count) } }
其实这取决于你有层次结构。 如果您正在使用一个导航控制器
for (vc in self.navigationController.viewControllers) { if (vc isKindOfClass(SKStoreReviewController)){ //Means it is present } }
- 自动从iTunes Connect下载销售报告
- 为什么xcode存档成功,但创build一个空的.xcarchive文件?
- 如何在iOS App Store沙盒中testing自动续订订阅的“续订”组件?
- 使用自己的开发人员帐户为App Store提交,为客户构buildiOS应用程序
- 苹果App Store拒绝5.1.5
- 应用程序帐户信息不正确
- 2014年4月/ iOS 7 – 有没有一种方法可以跟踪iOS应用程序的转换,将属性下载归入不同的广告系列来源,而无需使用IDFA?
- 在App Store中接受哪些iOs版本的应用程序
- Xcode 6 App Store提交失败,“您的帐户已经拥有有效的iOS分发证书”