json - Interaction of a iOS app with server -
i working ios app needs remote interactive server.in app have request queries post data server.which right way or appropriate way so. 1 better rest or json or soap this? there tutorial or documentation site?thanks
rest common way so.
basically, rest relayes on simple http requests & json,
both easy use ios sdk.
if model simple, can go straight forward http & json.
if it's more complicated, recommend using rest kit, here's link
for straight-forward solution, if need simple call existing rest api, here few basic lines of code (these shouldn't run on main thread)
// preform on background thread nserror *anerror; nsdata *apicallresponsedata = [nsdata datawithcontentsofurl:@"http://yourdomain.com/apicall?param=value"]; nsdictionary *response = [nsjsonserialization jsonobjectwithdata:apicallresponsedata options:kniloptions error:&anerror]; //lets result { "key" : "value" } nsstring *somefieldvalue = response[@"key"]; //.. need result values...
Comments
Post a Comment