iphone - How to send JSON data over NSURLConnection -


i have created method connects web service , posts string , receives string response. however, trying post json dictionary created using nsjsonserialization. however, xcode giving me error. have tried convert initial code. relevant lines below...

nsdata* logindatajson = [nsjsonserialization datawithjsonobject:logindatadictionary options:nsjsonwritingprettyprinted error:&error]; [request setvalue:logindatajson forhttpheaderfield:@"logindatajson"]; [request sethttpbody:[logindatajson datausingencoding:nsutf8stringencoding]]; 

the second line heres complains using nsdata nsstring required. third line complains logindatajson may not respond datausingenconding

i seem forcing nsdata object (because nsjsonserialization gives me) cannot used. best trying convert json string use existing request code, or should/can change request code accept nsdata opposed nsstring?

have tried use frameworks jsonkit or restkit? restkit specially used webservice communication json , internally uses jsonkit , 1 parser. think solve problem , maybe future 1 ;)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -