gpt4 book ai didi

swift - UIReferenceLibraryViewController.dictionaryHasDefinition-**返回结果的速度非常慢-iOS 13(模拟器和真实设备)-Xcode 11

转载 作者:行者123 更新时间:2023-12-03 07:36:03 25 4
gpt4 key购买 nike

刚推出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)
}
}
}

从上面的代码中, 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 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.226942+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.235839+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.244599+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.253388+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.262388+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.271329+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.280346+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.289581+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.298508+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.307121+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.339668+0100 DictionaryServicesTest[18527:3511667] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2019-09-20 09:38:09.339682+0100 DictionaryServicesTest[18527:3511797] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2019-09-20 09:38:09.339880+0100 DictionaryServicesTest[18527:3511797] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2019-09-20 09:38:09.352755+0100 DictionaryServicesTest[18527:3511667] Old state: 2 new state:2
2019-09-20 09:38:09.353305+0100 DictionaryServicesTest[18527:3511667] Consumed extension
2019-09-20 09:38:09.364478+0100 DictionaryServicesTest[18527:3511667] Old state: 2 new state:2
2019-09-20 09:38:09.373088+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.382055+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:09.391300+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1

......


2019-09-20 09:38:10.298739+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:10.308036+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:10.331372+0100 DictionaryServicesTest[18527:3511667] Got the query meta data reply for: com.apple.MobileAsset.DictionaryServices.dictionary2, response: 0
2019-09-20 09:38:10.347474+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:10.356643+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1

.....

2019-09-20 09:38:11.357946+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.367701+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.377362+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.387062+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.396676+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.406346+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.433850+0100 DictionaryServicesTest[18527:3511667] Got the query meta data reply for: com.apple.MobileAsset.DictionaryServices.dictionary2, response: 0
2019-09-20 09:38:11.450337+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:11.459251+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1



....


2019-09-20 09:38:12.490703+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:12.500646+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1
2019-09-20 09:38:12.510725+0100 DictionaryServicesTest[18527:3511667] Old state: 1 new state:1

最佳答案

尝试更新到iPadOS 14.0时,我发现此问题已消失。

关于swift - UIReferenceLibraryViewController.dictionaryHasDefinition-**返回结果的速度非常慢-iOS 13(模拟器和真实设备)-Xcode 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58025802/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com