0

After I upgrade my Xcode to the latest version. It shows this error. Not sure what it means.

enter image description here

Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52

2 Answers2

4

The ambiguous error occurs when the type of the object is AnyObject and the compiler has no idea whether the object can be key subscripted.

The solution is to cast result down to something suitable.
It seems to be a dictionary

if let dict = result as? [String:AnyObject] {
   let userId = dict["id"] as! String
   ...
}
vadian
  • 274,689
  • 30
  • 353
  • 361
0

You have to define the result type, for example if this is a Dictionary try:

let dic: NSDictionary = result
let userId: String = dic["id"] as! String
garanda
  • 1,271
  • 11
  • 16