My app will consume a xml web service that will pull info, images and documents from the server and store it offline (docs and images are stored on a path, not in the database). I need to perform some simple queries on the offline data for viewing and browsing the offline data.
There will be no updates made on the client, the data is readonly, no need to push updates back to the server.
Should I use Core Data? Or plain XML?
What is the best solution for storing this data?
Thanks.
CoreData, its reliable and will give you the query abilities you want. You could use sqllite too but CoreData will probably be simpler, especially if your data structure is not changing alot.
Related
I already have a django application and am trying to develop an iPhone app. I'm using mysql as the database for the django app.
Here are some questions I was having :
Is it necessary to use Core Data for anything?
Can I create a rest api to interact with the mysql database?
If so, would there be any advantage, at any place or reason, to use Core Data in addition to mysql. For example, for an app like Pinterest, Tumblr, Facebook, etc. are they using Core Data at all? If so, why and how?
Core Data is one way to give you a local database on the phone. With only MySQL on the server, the app cannot access any data when offline. Even in an online-only app, a local cache of some of the data can be useful to speed things up.
Similar to Django,where it has and database-abstraction API that lets you create, retrieve, update and delete objects, iOS has an CoreData. What under-lies is still SQL. From the django end, you need to create an api that returns the class of objects or something. On the iOS side, you have to call this api and parse the data and save it locally using CoreData.
Hope this helps..
I've been researching now for couple of days about this matter but with no luck.
I am learning iOS development with the plan of developing iPhone app mainly. Now this app will mimic the behaviour of my PHP site.
The question: Can I interact from my iPhone app directly with my tables to load and/or insert new data? if not mySQL then which database is used to host the data for CRUD operations? JSON objects? if yes, then how?
As you can see I am really unaware of the way and hope that some light should be shed on storing and retreving data from existing database or what I need to host new database to use with iPhone.
The "best" and easiest way (for me anyway) is to use CoreData.
CoreData is a data management system. You set up some objects and relationships in it and then interact with those (use fetch requests to retrieve them and stuff).
CoreData then manages a datastore (most often a SQLite DB) which it uses to store the objects and relationships etc...
Using CoreData removes the necessity of a DBA and a lot of the complex DB logic and stuff.
A good tutorial to look at is this one...
http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/
I bought this book though...
http://www.amazon.co.uk/Pro-Core-Data-Professional-Apress/dp/1430236566/ref=sr_1_2?s=books&ie=UTF8&qid=1358773284&sr=1-2
and found it extremely useful for everything from starting out to the more advanced stuff.
When used properly, CoreData makes it VERY easy to use and manipulate persistent data.
YES, You can interact from your iPhone app directly with your tables to load and/or insert new data; Check the next tutorial - interact with your MySQL/PHP server http://www.scott-sherwood.com/ios-5-uistoryboards-a-practical-example/
CoreData is good but limits to access to just iDevices.
I use couchdb, means a copy is stored in the cloud with auto syncing between cloud and devices allowing for web updates and also Android
My app currently uses core data. I created a new version of the app that is all cloud based and the database is online. Therefore this requires user registration/accounts to access the data. The easiest thing is for me to make it a separate app, but then I lose the user base I already have.
Is there a way for me to transfer data from the iPhone's core data database to the online database? I am using https://www.parse.com/
Have a look into this github project,
https://github.com/itsniper/FTASync
Sure. To transfer data from CoreData to Parse, just create a PFObject for each row in your CoreData table, and save them to Parse. You can use saveAll to be faster. Then, you don't need the local copy in CoreData any more, so you can remove it.
I'm working on an app that uses Core Data, and I'd like to be able to code it in a way that it can use a local SQLite store or a web-based store (with an XML or JSON response schema).
Is it possible to use the exact same code for the Core Data stuff and just select the appropriate persistence store based on a user's preference?
Look at the WWDC video "Building a server-driven user experience".
You can connect to a remote store via a URL but that doesn't sound like what you want as that would support only one store for every remote user.
Really, all you need to do is setup a regular SQLite store and then add a little code to send changes to the server via the chosen method. Then you could turn the server connection on and off as needed.
That would be simplest as long as you don't have a requirement that no data be persisted on the device itself.
In theory, yes. However you would probably wanna cache the data locally in case of network issues etc.
Take a look at this project https://github.com/AFNetworking/AFIncrementalStore which doesn't really implement a Web Service backed NSPersistenceStore, but it does try to achieve what you have in mind.
I am considering backing up data from an iPhone application using the Google App Engine (GAE) - I was also considering using Python to build a RESTful app to deal with incoming/outgoing data.
On the client side I am using Core Data to store the information I wish to back up, and retrieve using the GAE.
I was wondering whether there were any good tutorials/resources on carrying out the above or whether this is perhaps something that others have tried to implement.
Any advice, or pointers, would be most welcome.
An open-source implementation of a REST server for GAE-python is available here.
I know nothing about core-data, but I you could easily store the objects in GAE if you are able to serialize them as binary or xml.
Binary objects up to 1Mb can be stored as BlobProperty, and strings as TextProperty.
There is also a Blobstore API for objects up to 50 megabytes.
If you want to store your data on a server (or sync it) then you want to go through a intermediary format. I personally recommend JSON as it can be used with Core Data easily. Since you can retrieve a dictionary of all the values in an object it is trivial to convert that diction to JSON data and push it over the wire to your server. Your server can then retrieve that JSON data and translate it into whatever format the server wants to store it in.
Do you want to map your core data objects onto GAE datastore objects? If so, this could be tricky. As you say, you would have to implement the server logic with python or Java, and you r iPhone objects are in Objective-C. You would need some scheme to serialize / deserialize them.
An easier approach, if all you wanted GAE for was backup, would be to serialize the Core data objects and store them as blobs with key-value pairs in GAE.
I'm not aware of any similar approaches so I'll be keeping an eye on this post.