I'm having an issue/bug? where my https response returns JSON, as it should, but when i decode it, I'm suddenly told it is of type 'MLFeatureValue'?
Imported libraries:
- Foundation
- AVKit
- UIKit
- AVFoundation
- Vision
Using:
- Swift 4
- Xcode 9.2
- Project is ejected from react-native '0.54.3'
var request = URLRequest(url: URL(string: "https://vision.googleapis.com/v1/images:annotate?key=fancyApiKey;)")!)
request.httpBody = jsonData
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
let task = self.urlSession.dataTask(with: request as URLRequest) { requestData, requestResponse, error in
let parsedResult = try! JSONSerialization.jsonObject(with: requestData!, options: .allowFragments) as AnyObject
print("data", parsedResult)
guard let data = parsedResult["responses"] as? [String : AnyObject] else { return }
From the 'guard let data' line I get an error: "Cast from 'MLFeatureValue?!' to unrelated type '[String : AnyObject] always fails."
I have no idea where the 'MLFeatureValue' comes from, since I have nothing regarding machine learning imported in the file or even the project.
Thanks.