tags:

views:

1509

answers:

5

I need build a client server iphone app. Want to store a database on server and save it too on client's iphone. What strategy and what dbms' and tools i must use for it? AS my database can be enough heavy

+1  A: 

Hello.... This is EASY. If you control both parts of the system.

The magic word here is PLIST's.

IBM have a great example with an iPhone source project and a working google app engine deploy. http://www.ibm.com/developerworks/web/library/wa-aj-iphone/

Here is some ultra basic code.

// SaveOnline.

NSMutableArray *myArray = [NSMutableArray arrayWithObjects:@"one",@"two",nil];
NSURL *url = [NSURL URLWithString:@"http://www.hurl.ws/api/"];
ok = [myArray writeToURL:url atomically:NO];
if(ok) NSLog(@"saved worked");

You can also load this PLIST from the URL and load it back into your object pretty easily as well. The whole PLIST system is very cool. It is slighly verbose but I would not worry about that as it is ultra flexible and in the long run is going to save you hour and hours of debugging.

I also noticed there a lots of libraries on the server to convert PLISTs into native objects for PHP, Python and assume you can find libraries for Java or .Net.

Dont think about trying to do it in XML your self, its going to get messy ultra quick and yo are going to loose so much time trying to fix it when you dont need.

PLIST's are you friend so use them. John.

John Ballinger
+1  A: 

If your database objects are complex you will probably want to use core data and model the objects your own way in the iphone. Of course you will have to sort of translate them when you are going from your service database to storing in core data but that should not be too difficult. If you getting and XML or Json response from your service you should be able to easily parse them and construct your objects over on the iphone and just simply use core data to store them.

Daniel
A: 

The database that you are using on the server side doesn't matter, it's just a black box to the iPhone app. The app can communicate with this server via HTTP using XML, or PLISTs or JSON as John and Daniel recommend.

As far as what's easiest, just go with what server side language you already know. It's probably easiest to run it on something akin to Google app engine, I'd imagine.

bpapa
A: 

bpapa you note "the app can communicate with this server via HTTP using XML", I assume from that you mean web services?

I ask because I'm trying to demystify getting data from the iPhone to a data store such as provided by Google App Engine, and back.

Thanks // :)

P.S.) More to the point of this thread, Google has a great solution for scaleable data store creation without large capital investment. I've been looking at it, Amazon Web Services, and Windows Azure. It seems that, unless you have a heavy reliance on or strong ability in .net, Google's solution makes sense.

Spanky
A: 

I Have a Question here. I am new to PList concept. My question here is can we directly connect to a database which is locally located and also the one which is on the server, with out adding db in the application dierectly.

adusum
You should ask your own question, not tack a question into the answers to another question.
David M.
Sorry for that. Thanks
adusum