Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIReferenceLibraryViewController.dictionaryHasDefinition - **very slow** to return result - iOS 13 (simulator and real device) - Xcode 11

With iOS 13 just out I was testing my app in Xcode 11 GM2, it uses the dictionary you can enable on the iPhone to do a word lookup. The performance on iOS12 has been spot on, it is virtually instantaneous.

However, this seems to have changed with iOS 13. The code below, which is fairly standard, takes 3 seconds to respond!!! This happens on both iOS13 simulators and real devices with iOS13.

I have not seen anything this having been reported as an issue with iOS13 SDK or Xcode 11.

Could this be a bug that needs reporting? Or am I doing something wrong.

It's making my app look unresponsive. How do I deal with this?

This is easy to reproduce and the same code with an iOS 12.x simulator works normally.

My code is below:

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)
        }
    }
}

From the code above, the bit UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "test") is what introduces the 3 second delay.

Here is a PORTION of the debug log, I have not seen those "Old state: 1 new state:1" statements before, they only show up in iOS 13. What do they mean?

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
like image 816
David K Avatar asked Sep 20 '19 09:09

David K


1 Answers

Trying to Update to the iPadOS 14.0, I find that this problem is gone.

like image 68
Shawn 736 Avatar answered Oct 11 '22 08:10

Shawn 736