Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Best Way to do Mobile & Server Sync?

I have one app in which data sync part is involved, Currently I am doing by sending data in the form of XML through NSMutableURLRequest and receving through initWithContentsOfURL.

But as the amount of data getting huge,time to sync is also increasing.

If anyone have idea how to implement this in better way,or any changes made to above implementation. So that sync time is reduced.

I wanted to know the best approach/model to follow for doing Syncing.

Currently I am Following This method..
<ROOT>
<ADD></ADD>
<UPDATE></UPDATE>
<DELETE></DELETE>
</ROOT>

I am not asking about how make connection..

In my app user can add,update & delete from iphone as well as from server means website. I want to know how to sync the data in proper way (Proper Structure of Data in Xml). so data user can see there entry on the both side. Thanks in advance...

like image 650
Rupesh Avatar asked Nov 20 '25 09:11

Rupesh


2 Answers

You might want to check AFNetworking. Very easy to use and it has very good performance. You can also use the built in XML requests to send/receive XML data asynchronously and handle them as you please.

If you have any question on how to do certain things feel free to ask.

like image 179
Y2theZ Avatar answered Nov 21 '25 22:11

Y2theZ


//Better and effective to use the asynchronous request to the server that will cost less time and even your UI will be remained active

NSLog(@"Server Path:%@",dataUrl);
//connection
NSURLConnection *theConnection;
NSMutableURLRequest *Request = [NSMutableURLRequest requestWithURL:dataUrl cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]; 
[Request setHTTPMethod:methodName]; 
theConnection = [[NSURLConnection alloc] initWithRequest:Request delegate:self];
like image 26
Kuldeep Avatar answered Nov 21 '25 22:11

Kuldeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!