0

I am using an instance of MKLocalSearchCompleter to get string predictions whenever the text in my search bar has changed. I run into one problem when I type too fast into the search bar or when I hold my thumb on the backspace key - I get the following error: The operation couldn’t be completed. (MKErrorDomain error 2.)

func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
       if !searchCompleter.isSearching{
            searchCompleter.region = (delegate?.searchResultTableViewControllerNeedsUpdatedMapRegion(self))!
            searchCompleter.queryFragment = searchText
        }
    }

I am assuming just like reverse geocoding, with MKLocalSearchCompleter there is quota on request calls that can happen at any given time. If this is the case, can someone point out a work around...If not can you please explain to me what the problem seems to be?

I print out the list of predicted strings in the console and on the 5th line you can see the error.

fast food

fast food

fast food

Westfield San Francisco Centre

The operation couldn’t be completed. (MKErrorDomain error 2.)

Hilton Hotel

HP Pavilion at San Jose

HPS Mechanical

HP Pavilion at San Jose

Hilton Hotel

House of Prime Rib

hospital

hospital

4

0 回答 0