刚推出iOS 13时,我正在Xcode 11 GM2中测试我的应用程序,它使用您可以在iPhone上启用的字典进行单词查找。iOS12上的性能已经实现,几乎是瞬时的。
但是,这似乎已随着iOS 13发生了变化。下面的代码是相当标准的,需要3秒钟来响应!!!这在iOS13模拟器和带有iOS13的真实设备上均会发生。
我还没有看到任何有关iOS13 SDK或Xcode 11问题的报道。
这可能是需要报告的错误吗?还是我做错了什么。
这使我的应用看起来无响应。我该如何处理?
这很容易重现,并且与iOS 12.x模拟器相同的代码可以正常工作。
我的代码如下:
import UIKit
//I'm using storyboard with 1 button.
class ViewController: UIViewController {
@IBOutlet weak var buttonTestUIRefVC: UIButton!
@IBAction func testUIRefVCTapped(_ sender: UIButton) {
if UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "test") {
let referenceVC = UIReferenceLibraryViewController(term: "test")
present(referenceVC, animated: true)
}
}
}
Run Code Online (Sandbox Code Playgroud)
从上面的代码,该位
UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "test")
是引入3秒延迟的原因。
这是调试日志的一部分,我之前没有看过那些“旧状态:1新状态:1”语句,它们仅在iOS 13中显示。这是什么意思?
2019-09-20 09:38:09.175923+0100 DictionaryServicesTest[18527:3511667] Creating client/daemon connection: C94E0479-7F79-4E22-895D-7F1FEFB75C8E
2019-09-20 09:38:09.201599+0100 DictionaryServicesTest[18527:3511667] Got the query meta data reply for: com.apple.MobileAsset.DictionaryServices.dictionary2, response: 0
2019-09-20 09:38:09.218045+0100 …
Run Code Online (Sandbox Code Playgroud)