So I'm using the HERE iOS SDK. For some reason, the try block isn't working, I keep getting the error printing out that is 'sharedSdkEngineNotInstantiated'. The getCoordinates function is what I'm trying to test after instantiation--I included it so that you guys aren't left guessing what the end goal is. Thanks for any and all help!
class functions: NSObject, ObservableObject {
var searchEngine: SearchEngine?
override init() {
do {
try searchEngine = SearchEngine()
} catch let engineInstantiationError {
print("Failed to make the search engine. The cause was \(engineInstantiationError)")
}
}
func getCoordinates5(from address: String) {
guard searchEngine != nil else {
return
}
let searchOptions = SearchOptions(maxItems: 10)
let query = TextQuery(address, near: GeoCoordinates(latitude: 40.7128, longitude: 74.0060))
_ = searchEngine!.search(textQuery: query, options: searchOptions) { (searchError, searchResultItems) in
guard searchResultItems != nil else {
return
}
for index in 0..<searchResultItems!.count {
let number = index + 1
print("Location \(number): \(searchResultItems![index])")
}
}
}
}