MKlocalSearch showing locations far away from user location

I am using MKLocalSearchRequest() to find locations mathcing a search from the previous view and it works fine on WiFi but with LTE its showing matches from another state…

Is there a way to set the search region or parameters to search within the area set as my location by the location manger?



my code for this saerch:



let request = MKLocalSearchRequest()

            request.naturalLanguageQuery = (foodLocation)

            request.region = regionSearch



            let search = MKLocalSearch(request: request)

            search.start(completionHandler: {(response, error) in



            if error != nil {

                print(“Error occured in search: (error!.localizedDescription)”)




            } else if response!.mapItems.count == 0 {

                print(“No matches found”)


                let alert = UIAlertController(title: “Whoops!”, message: “There were no matches or the web service went down. Please try again.”, preferredStyle: .alert)

                let alertAction = UIAlertAction(title: “OK”, style: .cancel, handler: nil)


                self.present(alert, animated: true, completion: nil)



            } else {

                print(“Matches found”)



                for item in response!.mapItems{


                        print(“Name = (String(describing:”)

                        print(“Phone = (String(describing: item.phoneNumber))”)



                        self.matchingItems.append(item as MKMapItem)

                        print(“Matching items = (self.matchingItems.count)”)

                        let annotation = MKPointAnnotation()

                        annotation.title =

                        annotation.coordinate = item.placemark.coordinate

                        annotation.subtitle = item.phoneNumber




                        self.rowCount += 1





                    if item.phoneNumber != nil{









                    if item.url != nil {

                       self.locationWeb.append(String(describing: item.url!))




                    else {


Powered by WPeMatico


You may also like...

Comments are closed.