Develop an iOS App that gets contents from a remote DB - mysql

I am developing an education app for Kids.
The application is going to contain pictures, stories and video as well.
Including all above contents in the app will surely bloat it and hence i would like store all data on a server that will be accessed by my app.
I haven't used any remote databases (like MySQL or Oracle) with any other iOS app. In fact i am a newbie in developing such kind of apps. Can any one point me to a sample

Connecting to a remote mysql is really not recommended.
The security here is critical.
You should create a webservice and my advice to you is to make sure that the access to the webservice is restricted
The webservice can be your own "protocol" or any other well known protocol like SOAP
By your own I mean, json, csv .... or whatever.
Edit 1
The technology of your webservice should be dependent on many things.
If the system is small, and the code needs to be update very often, I would suggest to do it with PHP and some small(!) MVC framework like CI.
But if its a large system with needs of ACL (access control list) I will probably choose java with spring...

I suggest that : Do not connect to / use database directly from user application. It may causes serious security problems and your app should have native SQL drivers to connect db.
So, create a web service that receive queries from the application and response in XML, JSON or some other strings that easy to parse. This will be much easier than embed native APIs into your apps.

Related

How to access an existing database file through html5?

I'm working on an desktop app(hta) that need to access information from a database.
My challenge is that already I have the data I need in a sqlite database file. I just want to access this database file from my app then manipulate and display the results to the users.Is it possible to deploy an app like this? I'm not finding a way to access an existing database file through html5.(The sqlite database file will be created during the app installation.It is present in C:\filepath)
The solution will depend on your use case. I can see two of them.
1. Your application runs in disconnected mode (standalone)
HTML5 provides an API called Web SQL Database. It enables you to access an API for storage in the web browser. It's pretty much build around SQLite features. However, all the web browsers do not support it.
2. Your application can access a remote server
In the case you have a remote database, and your application is allowed to access it, I would suggest that you connect to your database by making requests to it. Of course, you will require to develop your own little API on the server side to access the database e.g. via XmlHttpRequest.
You can use javascript to access Web SQL databases. Remember, Web SQL is deprecated and only supported in Chrome and Safari. And Web SQL isn’t even actually part of the HTML5 specification.
For a starter's guide: HTML5 Doctor: Introduction to Web SQL Databases

Architecture tips for multi-platform software / API

I'm creating a multi-platform app, mostly for web interface, mobile and a windows application. The app will manage user task lists and sync them to the server, but also store them locally for processing data faster.
My idea of architecture until now is:
Keeping most of the processing on client side, eventually syncing with the server.
Developing an API to provide and receive data that will be saved on the server (basically just a json wrapper web service)
The data flow:
user Authenticates -> Requests updated Json objects to the server -> populate client-side objects -> work with client-side objects -> send a json object back to the server -> server updates data.
Is this a good approach? I've never done this, can you guys give me some tips?
I think you are on the right track. The idea is to decouple the front-end from the back-end. The backend shall expose a set of CRUD (Create, Read, Update, Delete) functions as RESTful JSON web services. All your different flavours of UI (mobile, web, windows) can consume the same API.
I would recommend for the web front-end to take a look at AngularJS together with bootstrap.
Regarding the backend, you could implement it as a simple Java web application with Jersey/JAX-RS or alternatively, you could check Node.js + Express.

How to exchange data between MySQL and Parse.com?

We plan to use a MySQL database as the backend for our (Java or Ruby on Rails) based web application. After completing the web application, we want to port the application to iOS and Android.
We want to be able to run the application in "native" mode - that is, if a network connection is not available to the smart-phone, the system should be able to store the data locally, and sync with the backend when the network connection becomes available.
The best kind of framework for this kind of syncing is a library/framework such as Parse.com.
The question to which we want an answer is: is it possible to exchange data between the web application data stored in MySQL, and the Parse.com data which is stored in a proprietary format on the Parse servers?
Answer to your question: It is indeed possible, but syncing data is an advanced topic.
However, you also state that you want to access the parse data when offline. As I understand it, you want Parse to handle the offline state, and then sync to MySQL when connection is back up. Parse does not offer functionality to store data offline, other than caching requests. You probably need another service for your specific needs.
I might have misunderstood the use case. If so, my alternate understanding would be that ALL data for the smart phones will be handled by parse: both offline and online, with syncing. The answer is still: parse does not offer this kind of functionality.

Load data from a MySQL database to an Objective C/XCode Project

I have a simple question to XCode/iOS developers out there. I just want to know what are the most basic ways of fetching/inserting data into a MySQL database from an Objective C/XCode program. Basically, what I am planning to do is to create a mobile application version of the website I am currently developing. In short, the XCode program I'm planning to do is a way smaller version of a PHP web application. The XCode program will be able to modify, insert, and fetch data from the database of the website.
Can you guys give me a hint? A tutorial (or links)? I'm not even a new XCode developer, I'm only about to begin being one for the capstone project I am developing with my group (I'm in college, if this info is even necessary LOL).
You should do :
Implement a sever API (Web Services) with your preferred language ( PHP,...) that can communicates with the Data base.
An objective C client ( iOS application) that communicates with the data base but using your API ( Web Services).
here are excellent tutorials that will show you how to do all the steps. Tutorial
I would use REST webservice:
Write a piece of code with XCode which do HTTP GET and HTTP Post to your server. Query data with GET and Insert Update delete with POST.
After this write your server side code in PHP , Java, whatever you know / like to receive those 4 operations, connect to database and send a result you.
This architecture is used in many mobile applications.
Has some Pro and so Cons, like everthing.
The Pro:
separated code connection to database, separated units => improved security. Probably you don't want everybody see your mysql root password... who can decompile the iPhone app.
With separated client-server: it allowed multiple connections, caching.
The list is very long here.
The cons:
Probably need to know 1 more developing language than Objective -C
Need web hosting, not only database hosting
The list is a lot shorter here and less important.

How to Make an Online / Offline Phonegap Application

I am investigating using HTML5 for a new suite of mobile applications that our company will be writing.
I found this demo here,
http://phonegap.com/start#android
Which shows how to use eclipse to generate and run an android application which is written using HTML.
Just wondering whether there is any information around about writing an online / offline application? This application would collect data based on the user input, and that data would be sent off to a central server and put into our central SQL server database.
What mechanisms could be used to connect and send the data to the server for instance?
Another requirement would be that some data would have to be sent and cached on the device, data related to the tasks that the logged in user has to perform.
You can interact with your server by applying traditional javascript techniques, like ajax, or other cross-domain methods like jsonp, iframes, etc.
The HTML5 localStorage will help you saving data on the local device, it's very useful when your data can be expressed as strings. But if your app requires more powerful tool for local data management, you can make a phonegap plugin with native code for anything you want.
In case of Offline-mode save the data in Local Storage which is feature of HTML 5. Whenever the user in Online Sync the data with the server. In case the data to be stored locally is quite large then use PhoneGap that allows to store some big stuffs
[Ref.: http://docs.phonegap.com/en/2.7.0/cordova_storage_storage.md.html#Storage].