rigdonmr February 2016

Swift: How to properly serve a Realm in deployment

I have an iOS application written in Swift using Realm as a database working locally on my computer.

Right now, when I make reads and writes from Realm, I believe it is to and from a local file on my computer. Obviously this will not work in deployment, because the Realm file needs to be the same for every user, and every user will have the ability to change the Realm, so it seems that the Realm must be on a server.

How can I make it so that when users perform reads and writes to Realm, it maps to the Realm file on a server. What type of server should I use? I currently have an Amazon S3 account, should I just store the Realm file in a bucket and download and rewrite the Realm file anytime someone makes a change (though that seems highly inefficient)?

EDIT:

To ask this in a simpler way, what is the standard way to store user data in iOS applications on a server?

Answers


dzk February 2016

See this answer. Unfortunately what you're proposing doesn't seem to be possible, at least yet.

For what you're proposing you're better off using a more traditional server-side database.

EDIT:

To ask this in a simpler way, what is the standard way to store user data in iOS applications on a server?

That's quite a broad question, but normally saving data on a server is done through using your own custom API + back-end, or utilising a back-end SaaS (such as the soon-to-be-defunct Parse, or AWS.

If you want to store user data on a server you need to do this through network requests on the front-end, and your API would modify the database accordingly. You would never modify the database directly on your front-end.

Post Status

Asked in February 2016
Viewed 3,285 times
Voted 4
Answered 1 times

Search




Leave an answer