6

I search places with the MKLocalSearchCompleter and refine the results when the tableView cell is selected. When a MKLocalSearchCompletion is selected and MKLocalSearch.Request() is started, I get these Errors (example selects Los Angeles): According to my research this is a very rare problem?!

  • [SearchAttribution] No matching attribution source found for org.volunteermatch ... (+4 other domains)
  • Error loading attribution info for identifier org.volunteermatch from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for org.volunteermatch" UserInfo={NSDebugDescription=No matching attribution source found for org.volunteermatch} ... (+4 other domains)

These are the instance variables in a TableViewController:

var searchCompleter = MKLocalSearchCompleter()
var searchResults = [MKLocalSearchCompletion]()

This code is running everytime the search term is changed:

searchCompleter.queryFragment = text
searchCompleter.resultTypes = .address
searchCompleter.region = region

In tableView … didSelectRowAt… this code is executed:

let selectedItem = searchResults[indexPath.row]
        
let searchRequest = MKLocalSearch.Request()
searchRequest.naturalLanguageQuery = selectedItem.title
searchRequest.resultTypes = .address
        
let search = MKLocalSearch(request: searchRequest)
search.start { (response, error) in
            
      guard let coordinate = response?.mapItems[0].placemark.coordinate else {
          return
      }
      // send to mainVC
     self.delegate?.userSelectedPlace(coordinate: coordinate)
}

Xcode 12.4, iOS 14.4 Simulator

wider-spider
  • 465
  • 4
  • 12

1 Answers1

-1

I had a similar error when I tried to load search results into table view. Then I found that my table view's datasource and delegate is missing. So make sure your tableview's delegate and datasource outlets point to the right file owner.

enter image description here

Dharman
  • 30,962
  • 25
  • 85
  • 135
MarkZ
  • 47
  • 6