iphone - Save changed data to database -


in app taking data server in json format , making changes in data.i able download , save data in app.but unable post data server. using sqlite , asihttp operation.i want save data on server on submit button click.

any saving data server.thanks

the best way achieve want create php based api on server, call api post data containing payload want save.

once have post data on server can use php parse out information , inject local database.

tutorial...

to call php api in objective c source on ios suggest using afnetworking nice networking framework ios: afnetworking (this has been updated version 2.0, , framework has changed slightly, in example i've linked 1.x version , class exists in version).

you can use afhttpclient class.

assuming instance of afhttpclient called:

afhttpclient *client; 

then use this:

first create dictionary containing php api parameters, e.g. api command, , data want pass server:

nsdictionary *params = @{@"cmd":@"uploaddata",                            @"datatoupload":[_datamodel somedata],                            @"someotherdatatoupload":[_datamodel someotherdata]}; 

then call post function on client this. note: has completion blocks called success or failure.

    [self.client postpath:@"/api.php"                              parameters:params                              success:^(afhttprequestoperation *operation, id responseobject) {           //success block call (do code here,           //update ui upload complete)     }     failure:^(afhttprequestoperation *operation, nserror *error) {          //upload failed... ui update here maybe?            } 

the rest in php on web server.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -