【发布时间】:2020-01-21 08:39:58
【问题描述】:
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
【问题讨论】:
-
确认这个问题在 Xcode 11.2.1 中仍然存在。即使在设备上,它仍然非常慢。
-
已确认.. 在 Xcode 版本 11.3 (11C29) 和 iOS 13.3 上看到同样的问题。
-
在 Xcode 11.3.1 上仍然遇到这种情况。有人知道吗?
-
即使没有检查字典中的单词,我也看到了明显的延迟。通过在文本视图中选择一个单词来打开内置字典,例如Safari,或多或少是即时的。我想知道是否有一种解决方法可以利用这一点。是否可以在选择文本时显示的小菜单中模拟点击“查找”按钮..?
-
刚刚向 Apple 提交了“反馈”(这与“雷达”相同吗?)。我不认为它是公开的,但记录在案的是 FB7601358。
标签: swift performance uikit ios13