Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Autocomplete function Crash after Call

I am using Google PlaceAutoComplete method to get suggestions of the Addess that is entered in textField.

 func placeAutocomplete(text:String)  {
            let placesClient = GMSPlacesClient()
            let filter = GMSAutocompleteFilter()
            filter.type = .Address

    placesClient.autocompleteQuery("New Delhi", bounds: nil, filter: nil) { (results, error) in
        guard error == nil else {
            print("Autocomplete error \(error)")
            return
        }

        self.addressArray.removeAll()
        for result in results! {


            self.addressArray.append(result.attributedFullText.string)
            print("Result \(result.attributedFullText.string) with placeID \(result.placeID)")
        }

    }

}

When i call this method. It crashes, say the Following error.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary boolValue]: unrecognized selector sent to instance 0x7fe338f01e40'

I have tried to found using exception breakpoint but doesn't work. Can any have idea, where i am wrong?

like image 940
Sucharu Hasija Avatar asked May 05 '16 11:05

Sucharu Hasija


1 Answers

I have resolved the issue by correcting in the plist for "allow arbitrary loads" in App Transport security Settings. I was typed it true but its type was set string instead for Boolean

like image 136
Sucharu Hasija Avatar answered Oct 16 '22 12:10

Sucharu Hasija