json - Iterate over AnyObject. Error: Type 'AnyObject' does not conform to protocol 'SequenceType' -
i'm using alamofire data json file. example of output: [{"image_name":"vacation"},{"image_name":"graduation"}]
i have problem when try access information json output.
alamofire.request(.get, url).responsejson { (response) -> void in if let json = response.result.value { json in json{ print(json) } }
the problem have json output anyobject , cannt iterate on anyobject. if following:
print(json[0]["image_name"])
then can see output correctly. how can iterate on anyobject?
you may need explicitly state type of json
array of dictionaries:
if let json = response.result.value [[string : anyobject]] { // ... }
Comments
Post a Comment