Need advice on syncing data between iOS devices in one app - ios

I built an in-house app for selling tickets and checking-in students to our High School dances. At the moment the app can scan a QR code with the student's information and add their name to either a "Sales" list or "Check In" list. Then the app can export these lists to a CSV file and we compile all the data.
App works perfectly as expected. NOW I want to be able to sync data between multiple devices so that every device will see an up to date Sales and Check in list. The check in list is most important because then our faculty chaperones can all see who has arrived to the dance in real time. I figured I would need to build a server to hold all the data as opposed to on the individual devices like I am doing now (CoreData). Can anyone please give me guidance or advice as to where to go from here? I am using Swift and developing for iOS 10.

I would just answer the general approach to tackle this problem since the implementations would largely be depending on many factors (what database technology is available, the platform of the server, etc.)
You are absolutely right, you need a server to hold the data. Technically speaking, it is a database that holding the data. Thus, you need a database running on your server (there are tons of selections here: Maria DB, SQL Server, Mongo DB, etc.).
Next, you need to build a web service on top of the database so that the iOS app can interact with the database (add/delete/update/read rows). Web service is a very common layer in full-stack application since you normally don't access the database directly.
Finally, you need to guard your web service with some sort of authentication. I.e. you don't want any random person out there to be able to access your web service without permission. There are many implementations out there to secure your web service and you should be able to google that easily.

Firebase might be the easiest solution. Its pretty simple to setup, and its pretty simple to set up data persistence when you go off line. I'm big on trying to stick with the built in Apple services, but Firebase is hard to beat for simple apps.

Take a look at CloudKit, or perhaps Firebase or Azure, as services that will provide a back end server for you, and give you a tested SDK to build against.

Related

What type of database should I use in diary app in ios?

It is also the first time to develop,
I want to make a diary app, but I don't know which database to use because I don't have basic knowledge of the database.
When I click on the calendar, I would like to post on that date
And I also need a picture that needs to be imported.
I can look for it even if I post this. I think it would be the fastest to ask. Thank you for reading my POST and hope everyone who reads has a nice day
Quick Answer: I would recommend persisting data on the users device instead of a cloud based database by using Core Data for the following reasons:
The content may be private or sensitive in nature, keeping it on the device is safer
Media attachments can become costly at scale, saving to device removes that burden from the developer
some cons of this route include the following:
Potential loss of Analytics by not using a cloud database such as Google Firebase
Cloud storage can be backed up in case the user loses their device (assuming they are not backed up via iCloud)
For a more thorough answer I recommend you provide more in terms of your objectives and audience.

Best BAAS for sharing private database records between users?

In essence, I'm building a private journaling app for iOS using Swift that will have a social feature. When creating a new entry, the user can choose to share the entry with specified friends from a friends list. The friend will receive a notification of the new entry, and it will be added to their own journal. The friend can later choose to accept or deny addition of the entry from their personal journal after review. Users won't be able to see each other's journals, they will only be able to share(add) entries to their friend's journals.
While I'd prefer to use iCloud, CloudKit won't allow me to share the entry records between users if I store them in a private database, and the information will be too sensitive to plop into the public database. CKRecordZones would be helpful, but they are only available for organizing a private database, so they will do me no good with sharing entries.
Can the privatized entry sharing I want be accomplished through Parse or perhaps another service I'm unaware of? Or will I have to build a custom backend to accomplish this?
Any advice would be greatly appreciated!!!
I think below links can solve your problem:
iOS 8 data sharing between users
How to share Core Data between multiple users?
ios share data between users
Read all 3 questions and right answers of them.
CloudKit would be the easiest when you are ok with limiting it to Apple devices only. If you wan tot make a quick start with that, then try out EVCloudKitDao
Until now the logical choice for this kind of apps was Parse. It's easy to implement and has a lot of features.
Amazon just released a new AWS Mobile Hub that looks very promising. It integrates with all AWS services, is very powerful and now also easy to use.
You could also use Microsoft Azure Mobile Service. It looks like it has similar features as AWS.
Of course there are more less known environments that also might work in your case but I think it would be wiser to stay with one of the above 4 well known choices.
Which of these you should pick is more or less a personal choice. They can all do what you want. If it's the best use for you depends on your use case.

link 2 iPhones for a single iOS app database

I'm developing an app for my summer iPhone class that is designed for couples, and am not sure the best way to have two different users phones reading and writing to the same database for a single account. The two users create and grant points to each other for "rewards", "penalties" and "prizes". I'm attempting to put the local databases into CoreData and then push it into iCloud. However, I'm only finding ways that that works for a single persons app. This is a two player game that needs to update a shared database. I would greatly appreciate if you would have any suggestions on ways to either send notifications directly to each and maintain congruent separate local databases, or to have a single back end database for two users in a single account that both users' phone can push and pull from to read and write. I'm having trouble finding the right path to pursue for this.
Thanks.
You can easily save Database on server side with the help of many mechanism like PHP Script is the best example for this.
link - Advices on server implementation for server/client structure iOS App development?
There is a third-party framework for iOS called Parse. It's a terrific backend service that adds a cloud database. You can create objects and store it in the cloud and access it anytime, and it comes with push notifications and analytics functionality. It's tuned for many platforms, including iOS and it's straightforward to access all of its functionalities.
The site is here: https://parse.com
Whenever you try to use one database for multiple device, you need to create / save database in server side or you can try Parse. because local database is always used for device specific.

Core Data Sync With Multiple Users

I would like to sync a core data app with a user with a different iCloud ID and I am trying to figure out the most graceful way to do this. I do not want the data to sync with all users, but want to be able to sync among family members for instance. From the research I have done, I do not think I can do that using iCloud Core Data sync because it only syncs between devices with the same iCloud ID. I have looked at this stackoverflow answer and read a little bit about Ensembles, Parcelkit and TICoreDataSync, Parse etc., but it is not clear to me if any of those options will allow me to sync with multiple users. Does anyone have a good method for syncing a Core Data app with multiple users?
Ensembles and TiCoreDataSync might work. They can use Dropbox file syncing, so in principle they should work with Dropbox shared folders. I don't think these are the main intended uses, so I suggest contacting the developers and/or doing some good testing yourself before assuming this would actually work.
You'll need to think about the user experience, though. At a minimum, your users would both need Dropbox accounts and would have to set up a shared folder before beginning to sync data this way.
Parcelkit probably won't work. It uses Dropbox's data store API which, unlike other Dropbox services, doesn't appear to support shared data.
Services that do support this kind of sharing exist-- for example, Parse and Firebase-- but make sure to review their pricing carefully before using them. Also of course, there have been any number of projects that have their own custom server back end, but that obviously requires having someone on the team who can do that kind of work.
You need to think about other device types (Android at least) if you want your application to be reaching more users.
I'm doing the same now by the following way:
Setup an online database with proper web services (careful with implementation for security matters - DB should NEVER be exposed by anything other than the web services).
Create a Class for your communication with the server (using Class methods with security handling like authentication and authorisation).
Use the class in your app to communicate with the server (SQL operations are done on the server).
To integrate with CoreData you need to create the model in your app similar to the structure in the backend database. Then you need to create a similar class for the app that deals with only local CoreData.
A higher level class might be required if you want to make sure that operations done on both server and local data storage.
Besides, you have to implement a lot of conditions to make sure that data written in local ONLY after making sure that it is stored online (or create an engine for differed operations to run later).
Another Way if you are familiar with notifications:
Use structured notifications between devices for data operations in order to keep everything in sync with other users. The problem with this is the "Autonomy" of the operations. If two operations were done in approximately the same time, you have to find a way to make sure the order of the operations is done properly (maybe timestamp or something).
I'm looking into the same thing for my app and I 'think' you can do a fairly unsecured version of what you are after using using the public folder in cloud kit as mentioned in this question (no accepted answer at time of posting) : Private data sharing using CloudKit
You would need to find a way to differentiate between data that is truly public and those shared among the users you need and some level of authentication.
I'm going to try exporting a permission file with access permission in it to whomever I want to share with combined with a unique identifier located in that permission file.
Keep in mind, as mentioned in the comments of the linked answer, my implementation will be security by obscurity (thanks for that phrase) unless you find a way of adding proper validation to it but my data is relatively insensitive.
Hope this, or any ridicule in the comments, points you in the right direction : )

Which database can be used with Xcode and at the same time be populated through a website?

We are trying to create an iPhone application that will automatically receive data from a database. Which is a database that will work with Xcode. Our goal is that users can go to our website and input information. That data will be recorded to a database. Once the user downloads our app, the info should then be retrieved from the database and included in the app. We are wondering what database is suitable. It must be able to receive information from a website AND submit it to an application.
You're unlikely to find a iOS "aware" database that can automatically sync content over the internet.
However, you can of course obtain the data over the internet yourself and then insert it into the local database on the device, in which case the popular (and supported out of the box) SQLite would seem like an obvious choice.
As #Deepak also suggests, you could use Core Data which is a (sort-of, ish) ORM that can automatically use SQLite as it's underlying storage mechanism.
The solution that most people use in this case is to use an RDBMS like MySQL and build a web-service layer on top of the database for the entities that your iPhone app is interested in.
This way, when a user goes to the web-app, they can add the data that you allow them to add there, and later on they can access the same data from the iPhone app via the web-service layer also.
Couchbase's new iOS-Couchbase framework is in beta right now - all the functionality of Apache CouchDB on your favourite developer platform - at https://github.com/couchbaselabs/iOS-Couchbase. the iOS release is new but we're looking for it to go places!
Its awesome sync abilities would allow you to pull down any relevant content from your website via HTTP/JSON, or further formats using shows and lists if needed. Pushing data the other way is just as easy. Sync can be continuous, or on demand, bidirectional or one way.
Take a look at some of the Couch App frameworks (not for iOS but for your website)
http://techzone.couchbase.com/community/articles/couchdb/recipes
http://www.mail-archive.com/user#couchdb.apache.org/msg13928.html lots of comments on this thread
A+
Dave

Resources