remote data update on iphone programming - iphone

I created an iphone application that uses database. Here is the problem, this application should work offline. I am not going to use a remote database but i have to update these datas every 2 month. How can i update the datas that was already stored in application? What is the best way and keywords?
Thank you.

The question isn't the easiest to decipher..... but from what I gather...
If you don't have a web service to call (I guess this is what you mean by remote database??), then you're only option is to release an updated version of your app every 2 months with an updated database.

Related

Updating my Windows Store App [duplicate]

This question already has an answer here:
How to Delete Files and Application Data Container Values in One Go?
(1 answer)
Closed 8 years ago.
I would like to update my Windows Store App, but I need to delete everything in the local state folder of the application:
C:\Users\usr1\AppData\Local\Packages\myApp\LocalState
I am not familiar with the process of updating Windows Store App and the official documentation does not clarify how can I clear the folder just as if the App was reinstalled.
I was wondering if I had to do this by hand (using the version number of the App) or if there was an automated way to perform it.
Let me first give a little background. By design, app data is preserved across the installation of app updates. The reason for this is that the versions of your state (app data) are typically a separate concern from the versions of the app itself. That is, an app could go between versions 1.3 and 4.1 and still use the same app data structures.
The version of the app data is set through Windows.Storage.ApplicationData.SetVersionAsync (http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.setversionasync.aspx). Where this primarily matters is with roaming data, as this version mark determines what distinct copies of the roaming data are preserved in the cloud.
Now in your case you're talking about local app data, not roaming, in which case you can either use SetVersionAsync, or you can simply maintain a version number in an app data setting yourself. For your scenario (which sound like clearing out a cache of sorts), using your own setting is probably better, because if/when you use roaming state you won't be having to change the app data version with every app update.
If you have a version number of your own, then, simply write your updated app to check for whatever version you don't want to carry forward. If that version exists, then call ApplicationData.ClearAsync(ApplicationDataLocality.Local) (see http://msdn.microsoft.com/en-us/library/windows/apps/hh701425.aspx). You can call ClearAsync with no args to clear local, temp, and roaming all together.
If for any reason you have state that can be migrated instead of rebuilt, then you can use that version number to check for what you need to migrate.
The other way to do this is to use a background task with the ServicingComplete trigger. A guide for that is here: http://msdn.microsoft.com/en-us/library/windows/apps/jj651556.aspx. You'd basically just have the background task call ClearAsync as before and/or migrate the state.

Syncing Database (sqlite) from WebService(Json/XML) for iOS

I have a Web Service and sqlite database. In this, web service will be used to store data inside database. Now I want to include sync functionality as - Whenever application starts at that time the database will start to load its table's data through web service.
Now after some time when I update my my web service the database will be updated accordingly. My question is that what are the best practices that I must follow for this update. Should I clear whole DB and start adding all rows again(I know this will take a lot time) but If not this then how do my database will add only particular data from the web service?
Thank you.
What I suggest you is:
store all your webservice content into db first when the app starts.
display your content on the screen from db only.
again when you need to refresh or recall your data just update the database.
Thus, you will always find all your fresh data into database.
Downloading and updating the entire server data will prove expensive. It will use more bandwidth and prove costly to your customer. Rather than pushing the entire load (even for minor update), send a delta. I will suggest you to maintain version information.
When application downloads the data from web service for a said version and store it successfully in the database, set the current updated version as well in the DB.
When app starts the next time, make a light weight header request to get just the version info from the server. The server should respond to this header request with the latest data version number.
Check the version from WS with the current application data version stored in the DB. If the server has an updated version, start the sync.
The version change information should be delta i.e.
For new version, server should send only the information that is changed since the version available with the device.
You server should have capability to calculate the delta between two versions.
Delta information will typically have sections like, new data, updated data, deleted data etc.
Based on this, the iOS app will make the necessary CRUD(Create, Read, Update and Delete) operations on the DB data.
Once the iOS app updates itself, then you can update the DB version to the latest received version from server. Until then let it remain dirty for proper error handling.
Hope that helps.
I would recommend you use RestKit's superb Core Data support.
By using RKEntityMapping you can map your remote objects from JSON or XML directly to Core Data entities in your database.
RestKit will automatically maintain the database for you, inserting and updating entries as appropriate from your web service. (In my experience, I've found deleting objects requires a tiny bit of extra work depending on how RESTful your web service is).
RestKit definitely does have a learning curve attached, but it's well worth it: having deployed it a couple of times now, is definitely a much better solution than manually writing your own SQLite/Web Service syncing code.
First you need to set all webservice content into your SQLITE.and what you want to display get that data from SQLITE.and perform opertaion into that sqlite table and when once all this done you need to changes made are saved it into webservice.
Follow this way.

Call an IBAction existing from a remote server

Is it possible to call an IBAction from a remote server? It would make my life easier. I have a quiz app for the iPhone, and there I have an IBAction/arc4random consisting of the quiz questions and answers. My little problem is that I'm only updating the app with more questions every time I submit a new version. The rest of the app stays exactly the same. If I somehow instead could update an .m file somewhere on a server, I wouldn't have to submit a new version every 1000 questions. Is that even possible?
Thankful for answers.
If you use a service like Parse.com you can build a database and just pull questions remotely similar to a web service. That's what we're doing in our Trivia app.
The short answer is NO. You can't change or call a code in your app from the remote server. You can however create a database with your questions/answer and pull database from your server by the app.

Distributing database updates to an iPhone application without downloading the whole database

I have a product database which I want to distribute to an iphone user application. Its data is stored in an SqlLite database.
What i want to ask is: If i update one products' price in the database, what is the best approach to update the users copy of the database in the iphone application ? I don't want to send the whole database time to iphone users.
If i send only updated products every db will be different on each iphone after some time.
I am pretty confused.
Any idea will be appreciated.
Thanks for your help
You could use a global revision Id for your database. Each item in your database would additionally include a field which keeps track of the revision they were last updated at. This is much like the way subversion works.
Whenever you update one or more fields in your central database you will increment the global revision number as well as the revision number for each of the updated entries.
Your iPhone database copy would then have to keep track of its own revision. Whenever it connects to the main database it can then ask for changes made since its own revision.
Eg. if the main database is at revision 1234 and the iPhone is at revision 1222, it would. Then receive the updates corresponding to 1223, 1224, etc.
Since the iPhone is designed to connect to the internet, why don't you get the iPhone user application to download an updated price list from the internet (your website) each time it opens, or every week, or similar?
update:
If your database is large, you could track updates to your database with a version number, and create 'patches' to your database in the form of SQL statements, to move from one version of the database to the next.
When the user application connects to your website, it can look for the appropriate patches to update to the current version, and download them.
This should reduce the amount of data downloaded to the minimum, especially if you compress the patches (using zip).

Django Iphone sync

I am writting a django app and Iphone app, I need to keep them in sync.
Users can delete, update and create new objects in the web app, and in the iphone app.
When they get online with the iphone both app must be in sync.
Is there simple way to do this?
Thanks,
Joaquin
In general: There's no simple way. But I'll outline an approach.
If you don't care about changes being overwritten: Keep a timestamp of the most recent change to each record, and a timestamp of each sync. When syncing, you get a list of all updates on the iPhone since the last sync, and all updates on the server. You write from the iPhone to the server if the iPhone timestamp for that record is newer than the server one, and vice versa.
But you probably care. Say you've edited a note called "Where to meet up on Friday." It started out empty. Now, on the phone, you've written, "My house." Ten minutes later, your friend edits the same note on the server and writes, "The diner." Who wins out? Stack Overflow can't answer that for you; it's application-specific.
OK, so modify the approach above: if both the server version of a record and the local version have been edited since the last sync, then you have to ask the user what to do. That's the basic algorithm.
If you care a lot about changes not being overwritten, to the point that you want to merge changes to different places in the same documents, then your system will begin to approach the complexity of version control systems like Subversion or Git. Not at all simple.
There's no built in way to do this. You need to keep a server data store, and a local data store on the iPhone, and when online, check the differences manually, and see what action you should take on the server and the iPhone side (delete, update, etc.).
Sync is usually hard. I suggest you start laying out the server and iPhone data stores, and think how they relate, and how can the server or the iPhone know the status of their counterpart record, so to keep them in sync.