I try to get nearby points of interest with following code.
var results: [MKMapItem]
let testLocation = CLLocation(latitude: 39.7282754913204, longitude: -121.83680282031702)
let request = MKLocalPointsOfInterestRequest(center: testLocation.coordinate, radius: 100)
request.pointOfInterestFilter = .init(including: [.cafe])
let search = MKLocalSearch(request: request)
do {
let response = try await search.start()
results = response.mapItems
} catch let error {
searchLogging.error("Search error: \(error.localizedDescription)")
results = []
}
But got following error message:
SpatialPlaceLookup ticket submission failed. Too many parameters: 1 max allowed: 0
Search error: The operation couldn’t be completed. (MKErrorDomain error 5.)
Post
Replies
Boosts
Views
Activity
Encountered the same problem。
let testLocation = CLLocation(latitude: 39.7282754913204, longitude: -121.83680282031702)
let request = MKLocalPointsOfInterestRequest(center: testLocation.coordinate, radius: 100)
request.pointOfInterestFilter = .init(including: [.cafe])
let search = MKLocalSearch(request: request)
do {
let response = try await search.start()
results = response.mapItems
} catch let error {
searchLogging.error("Search error: \(error.localizedDescription)")
results = []
}
Error Message:
SpatialPlaceLookup ticket submission failed. Too many parameters: 1 max allowed: 0
Search error: The operation couldn’t be completed. (MKErrorDomain error 5.)
code-block