ios - How to send SwftyJSON with Alamofire? -


i have long data want send api server alamofire created json object swiftyjson , if pass json alamofire gives error please explain missing ?

json :

{   "skill" : {     "name" : "ios",     "desc" : "objective-c, swift"   },   "langinfo" : [     "hindi",     "english",     "french",     "russian"   ],   "eduinfo" : {     "degree" : "mca",     "school" : "university of kota",     "year" : "2013"   },   "geninfo" : {     "firstname" : "varun",     "email" : "varun@gmail.com",     "state" : "rajasthan",     "address" : "plot no. 00, bhagwan nagar 31,",     "zip" : "21354",     "phone" : "123456789",     "lastname" : "sharma"   } } 

code :-

var jsonobj = json(skilldata.data)         println(jsonobj);          let parameters = [             "data": jsonobj         ]         alamofire.request(.post, baseurl+savedata, parameters: parameters)             .responsejson { (_, _, json, _) in                 println(json)                 let dict:dictionary<string, string> = json as! dictionary<string, string>                 println(dict["status"])         } 

here skilldata.data var data = dictionary<string, anyobject>()

and error on line .responsejson { (_, _, json, _) in error

edit #1 code error

edit #2 xcode ver :- 6.2.3

and

using pod alamofire , swiftyjson

source 'https://github.com/cocoapods/specs.git' platform :ios, '8.0' use_frameworks!  pod 'alamofire', '~> 1.2' pod 'swiftyjson', '~> 2.2.0' 

type json not conform object protocol need object jsonobj. after getting object parameters type [string : anyobject] , after that, meet parameter type of alamofire request

let parameters = [         "data": jsonobj.object     ] 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -