i'm working on an iPhone application which retrieve sqlite database from server through json/rest api. And user can add rows to its tables locally and can update it locally. Now, as i added some rows to tables in local database, i want to sync/insert only those new rows to server database from my local updated db. Please help if somebody knows about that api method(json/rest) or If there is any tutorial related to it please help.
相关问题
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- CALayer - backgroundColor flipped?
- Design RESTful service with multiple ids
相关文章
- 现在使用swift开发ios应用好还是swift?
- json_encode 没有把数组转为json
- Livy Server: return a dataframe as JSON?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Unexpected end of JSON input from an ajax call
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
When you say you are retrieving the "sqlite" database, do you mean a "json" representation of all the tables and their rows? I'm assuming you're not actually sending the "sqlite" db file.
For sending and retrieving json via http you can use NSURLConnection and NSURLRequest for simplicity, because they are built in. If you want to enforce a mapping to core data, you can use the RestKit framework for both the connection and data handling.
Here is an example implementation of the former solution - it assumes you are ARC, you will need to add the appropriate retain and release statements otherwise.
1) declare the class you're using as the appropriate delegate
2) declare a responseData object that will be used to receive data
3) create the function that sends the json request
4)implement the delegate functions to receive our data
If you want to update the remote database with some new information, just keep track of the new rows locally (rather than just merging them with the full dataset) and send a new request containing only those rows to an endpoint that will add them. That is the simplest way to do this without enforcing an actual mapping.