The backend database of the IOS application is NOSQL / Mongo DB. We have to store the data offline when the user is not connected to the internet & and sync later when he is online.
i gone through the couchbase ios tutorial .
What is the best way to store data locally & sync with server later.
Kindly provide the architectural inputs for the above.
I have experimented with multiple ways of doing this and CoreData is really unbeatable. All the backend is done by Apple with none of the 'hard stuff' done by you. It's quite easy to implement an SQL database app using the SQLite C API, however, cloud synchronisation is another story altogether. Core Data can be used with iCloud which of course stores the data and syncs only when the device is connected to the internet.
Related
Is it possible to use mongoDB locally in an iOS app? Or do I have to convert the data to SQLlite?
MongoDB Realm is your solution!
check here
For local data storage on iOS device from your app you should consider CoreData as the recommended approach or go for SQLite. There is no mongodb for iOS.
Since you were looking at mongoDB, I would assume that you were looking at a NoSQL alternative and/or specifically a JSON based Document store for your local storage. In that case, as noted above, MongoDB does not have a local storage option for mobile apps.
You may want to look into Couchbase Mobile which includes Couchbase Lite which is NoSQL embedded storage for iOS, Android, Windows. Depending on your needs, you can use Couchbase Lite in standalone mode or you can sync your data to the cloud via Couchbase Sync gateway and persist data in the cloud using Couchbase Server.
Some other considerations to be factored into your choice of mobile database - platforms to be supported, type of data to be stored (structured, semi-structured, unstructured) - the importance of a schema/ data model, how frequently do you expect your data model to evolve - need for data migrations ,data sync capabilities among others
No, Mondodb is a DB storage system designed for backend enviroments. For iOS os recommended use CoreDate. But if you looking for storage NoSql, i recommend use Realm or CouchBase
Realm:
https://realm.io/
CouchBase:
https://developer.couchbase.com/documentation/mobile/current/installation/ios/index.html
This tecnologys can work with any API and you can storage values from any source.
I am working on an app that collects user data including photos. It's mandated that this app should work in offline mode - meaning that the user can complete surveys and take photos without an internet connection and that data should sync back to a remote database. How is this generally handled? Do I create a local database with Core Data and write an additional layer to manage saving/reading from a server? Are there any frameworks that help facilitate that syncing?
I have also been looking into backend services such as Firebase that include iOS SDKs that appear to handle a lot of the heavy lifting of offline support, but it does not appear to support offline syncing of image files through the Firebase Storage SDK.
Can anyone recommend the least painful way to handle this?
Couchbase Mobile / Couchbase Lite is probably the best solution I've come across so far.
It allows offline data storage including binary data, and online syncing with a CouchDB compatible server. It works best with their Couchbase Server / Sync Gateway combination, but if you don't need to use filtered replication or 'channels' (e.g. for syncing data specific to a single user with a shared database), you can use Cloudant which saves you having to set up your own server.
Its also available across most platforms.
Generally for images it is best to use NSFileManager and save your images in either the documents directory or the caches directory depending on the types of images you are storing. Core Data or Firebase are databases that are more qualified for data than images although they do support arbitrary data storage.
You can also try SDWebImage which has a lot of features around loading and storing images.
We are considering using Azure offline data sync for our app which usually has very sporadic connectivity (In most cases users sync their data once a day). Thing is that mobile app needs to hold a lot of data (tens of thousands of products). Currently we have our own sync solution which works fine with sqlite.
My question is, do you have any experience or thoughts about performance of Azure offline data sync? Will it be able to handle really large datasets?
Thanks you
Azure mobile service is the cloud version of popular Microsoft sync framework. This is a light weight json API which tracks changes between local and remote data store. It transfers only changed rows, hence data traffic will be minimum. But when you sync very first time and you have huge data, it might be a problem.
You could overcome this problem by carefully designing your database structure. Azure SDK provides api to sync table by table, which gives you enough flexibility to choose what to sync and not.
I'm considering using CouchBase Lite instead of CoreData for my OS X and iOS apps. However, I need to be sure whether I can sync the data between OS X and iOS apps via iCloud in case Couch Base Lite is used.
CoreData syncing is possible via iCloud. I hope it could be done for CouchBase Lite.
I don't know how CouchBase Lite writes data out, but your options with iCloud are Core Data, flat files, or NSUbiquitousKeyValueStore. If CouchBase Lite uses flat files, it should work, as long as you explicitly set every one of its files to be synced by iCloud and you can resolve any conflicting changes that might come up in those files. File sync over iCloud will sync files and notify you of conflicts, but resolving them is up to you.
Whether that makes it easy or difficult depends on the details of CouchBase Lite's data storage.
If you are going to go with CouchBase, you should sync via a CouchBase server. Sync is a strength of CouchBase, and it would be silly not to take advantage of it.
Trying to use CouchBase via iCloud sounds like a bag-of-hurt. It wasn't designed for that purpose.
If you want to stick with iCloud, you can use Apple's Core Data sync, or a third party framework. TICDS and Ensembles are both based on Core Data, and can sync via iCloud. (Disclosure: I have contributed to both projects.)
Couchbase Lite was made for sync compatability with Couchbase Server; however, for folks who want to continue to utilize a relationship between iCloud and the device, and thereby need Core Data, we do have a Core Data adapter that you could use as migration or symbiosis with Couchbase Lite. Some sample work is available here: https://github.com/couchbaselabs/cblite-coredata-sample-ios
The adapter itself you can see here: https://github.com/couchbase/couchbase-lite-ios/tree/1.0-beta3/Source/API/Extras
Jessica
I'm developing a site-specific installation for an office lobby which will display content on 6 iPads. The installation has several megabytes of data which will be managed by a django webapp. I'm considering different strategies for fetching the content data from the web app. So far, I have simply been dumping the data in to xml format and fetching it via a single http request from the iPad to the content server. I then load all of the content in to memory on the iPad.
I'm beginning to have some concern that I may run in to memory issues as the amount of content grows, and that storing the entire database in-memory won't work. The natural next step is to think about a database on the iPads. I'm using sqllite for the content server. Seems to me that it may be feasible to simply download the entire database file itself and query it directly from the iPad.
Proposed Approach
Download the actual sqllite database file nightly from the django content server to each of six iPads used in an office lobby installation.
Things I like about this approach:
It could be really simple. It removes the whole web services layer from the system.
It protects against network problems nicely. If the network is unavailable, the worst problem is that the iPads display stale data, as apposed to there being no content if the system is network-dependent.
Things I don't like about this approach
I'm not sure how to safely download the file. How to I ensure that the file I'm downloading is in a valid state, and I'm not downloading while someone is updating it?
I've never heard of anybody doing this, or even considered doing it. It seems like it's far from tried and true.
My questions
Can anyone think of reasons why this is a bad idea?
How can I safely download a sqllite file with confidence that it's in a valid state?
Why don't you create a Syncing system - perhaps with JSON.
I've done something like this before - I had a central repository server on site that was running my Django web application. The different iPads would sync regularly with the web app's database making sure their local data matched the server data, if not it would update via json.
On the iPad itself, I was using phonegap's SQLITE syntax which worked perfectly for storing the clientside data. But the key was syncing this database via json to the central repositorie's database - rather than physically moving the SQLite db over to the ipad.