开发者

iOS Web Database

I need to populate a table in an iOS application with data from a Web database

I already have a MySQL database set up but reading about this it seems there must be an easier way for the iOS to interact with a web database

Any help or pointers would be appreciated,开发者_开发问答

Thanks


You should make an API interface.

Then use the API to communicate with the database. Using the database directly is a very bad thing to do.

If you are really desperate, consider using the MySQL C library. This article explains it in great detail: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/


For my application, I chose to create a web service to act as an intermediary between my application and the database.

This layout has several advantages. Considering you have MySQL database you can try to create some php scripts (I chose php because the API to work with mysql is very very simple and as you said, you don't need very high security or performance).

You can use these scripts through HTTP requests (you can use NSURLConnection to do these).. These scripts connect to mysql , fetch the data you need to pass the result back to the application in an easier to use format (e.g. I use JSON).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜