问题
let parameter : Dictionary<String,AnyObject> = ["action":"add-playlist-item","playlist_id":self.dictPlayList.objectForKey("ID")!,"kod_id":arrayOfID]
error ["action": add-playlist-item, "playlist_id": 166, "kod_id": <_TtCs21_SwiftDeferredNSArray 0x7c615620>( 21, 18 ) ]
_TtCs21_SwiftDeferredNSArray 0x7c615620 what does this error mean??
回答1:
Array is a value type and it's not an object, but a struct. So it doesn't conform to AnyObject protocol. Use Any instead of AnyObject. See more details here and here.
回答2:
Check that you are using JSON parameter encoding, not URL encoding.
You may be having the same problem I was having. I was seeing <_TtCs21_SwiftDeferredNSArray 0x7c615620>
appear in my requests too. When I changed to JSON encoding, everything worked. I don't think a dictionary structure like that can be properly URL encoded. I'm not sure how you're actually making the request or I would post code.
来源:https://stackoverflow.com/questions/36812317/geting-error-with-dictionary