let orderID = (responceDictionary as NSDictionary).value(forKeyPath: "result.id") as? String
错误: '[AnyHashable:Any]?'不转换为“NSDictionary的”Xcode Swift - 任何不可转换为NSDictionary
我不完全知道如何从任意投 - >的NSDictionary但作为一个字符串,它似乎与我试图抛出错误。
let orderID = (responceDictionary as! NSDictionary).value(forKeyPath: "result.id") as? String
以上编译但使用此引发另一个错误:将永远失败。
Moltin.sharedInstance().cart.order(withParameters: orderParameters, success: { (responceDictionary) in
let orderID = (responceDictionary as NSDictionary).value(forKeyPath: "result.id") as? String
什么样的反应,你在这里尝试分析的麻烦。请添加JSON结构。 –
@AdilSoomro我已经添加到问题。 – Owen26