I’ve an iOS app that interacts with a custom API, that in turn interacts with the DB. I was thinking to eliminate the custom API step and access the DB directly from the iOS application (MongoDB).
Now several questions emerged:
- It would be a security issue to distribute login credentials (even if they’re encrypted) with the app.
- I guess due to flaky networks the DB could be corrupted if designed improperly.
- Are there any real world examples where a database backend is directly accessed from Cocoa?
Basically it boils down to yes or no – and why.
PS: The database resides on the web, not an intranet/corporate network
There are pros and cons. I think you listed all the cons. IMO, there are no pros other than having one less layer to maintain. However, if you think this particular database will ever be accessed by anything other than the iOS app, you might as well go ahead and do the intermediate layer – you’re going to need it eventually. Might as well plan for it at the outset.