First of all, in Swift 3, the equivalent of Objective-C id
is Any
, not AnyObject
, which also avoids casting AnyObject
.
The error message indicates that an illegal type ( Parameters
) is being used, JSON only supports string
, number
, <null>
and array
/ dictionary
.
In your case, the dictionary [String:String]
, type annotation is not required at all
let param = [ "email" : txrNRC.text, "password" : txtPassword.text ]
If txrNRC
and txtPassword
are optional, you need to expand them or use the nil join operator to assign a placeholder if nil
source share