简体   繁体   English

将iphone应用程序连接到mysql数据库的最佳方法是什么?

[英]What is the best way to connect an iphone app to a mysql database?

I want the way with the fastest execution time. 我想用最快的执行时间。 I'm not feeling comfortable of using web service because i need to create separate php pages and retrieve data as xml. 我对使用Web服务感到不舒服,因为我需要创建单独的php页面并将数据检索为xml。 If you think its good to use web service please tell me why. 如果您认为使用Web服务很好,请告诉我原因。 I want to code my database queries right on my c/objective c pages. 我想在我的c / objective c页面上编码我的数据库查询。

I've been searching for libraries. 我一直在寻找图书馆。 I saw this sequel pro - won't i have any problems on using this - like licensing issues? 我看到这个续集亲 - 我会不会在使用这个问题时遇到任何问题 - 比如许可问题? I also saw this libmysqlclient of cocoa but some say its not working well. 我也看到了这个可可的libmysqlclient,但有些人说它运行不好。 I've also read about a library developed by Karl Kraft found here http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/ but don't know if i could trust this. 我还读到了Karl Kraft开发的图书馆http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/,但不知道我是否可以相信这一点。

I would really appreciate you help. 我真的很感谢你的帮助。

Definitely build a web service to act as an abstraction layer to your database. 绝对构建一个Web服务,作为数据库的抽象层。 Here are some significant reasons in my opinion: 以下是我认为的一些重要原因:

Since you want speed, you will be able to add caching when using the webservice, so you will essentially eliminate the need for identical queries to run (sometimes). 由于您需要速度,因此您可以在使用Web服务时添加缓存,因此您基本上无需运行相同的查询(有时)。

If you need to change your data model later, you just have to modify the webservice backend and don't have to update your app. 如果您以后需要更改数据模型,则只需修改Web服务后端,而无需更新应用程序。

You can better control security by not exposing the database to the world, and keep it safe behind the web service. 您可以通过不将数据库暴露给全世界来更好地控制安全性,并使其在Web服务后面保持安全。

Your database credentials should not be stored in an app. 您的数据库凭据不应存储在应用程序中。 What if you needed to change those? 如果你需要改变那些怎么办?

I strongly suggest a web service. 我强烈建议使用网络服务。 Hope this helps. 希望这可以帮助。

Connect to your DB by PHP and output the result as JSON is much better and faster then xml and less coding if use JSON Framework. 通过PHP连接到您的数据库并输出结果,因为如果使用JSON Framework,JSON比xml更好更快,编码更少。

and never never try to connect to your DB from your iphone because it easy to sniff out the request from iphone. 并且永远不会尝试从您的iPhone连接到您的数据库,因为它很容易从iphone嗅出请求。

Being safe then Sorry, keep that in mind 保持安全然后抱歉,记住这一点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将iPhone应用程序(iOS SDK)连接到php / MySql后端的最佳方法是什么 - What's the best way to connect iPhone app (iOS SDK) to php/MySql backend 更新iPhone应用程序数据的最佳方法是什么? - What is the best way to update data for an iPhone app? 在iPhone应用程序中绘制椭圆的最佳方法是什么? - What is the best way to draw this ellipse in an iPhone app? 保存iPhone应用程序设置的最佳方法是什么? - What is the best way to save iphone app settings? 编写混合iPhone应用程序的最佳方法是什么? - What is the best way to write a hybrid iPhone app? 从iPhone应用程序-> PHP-> MySQL保护用户密码的最佳方法是什么? - What is the best way to go about protecting a user's password going from iPhone app -> PHP -> MySQL? 在iphone应用程序中记录调试信息的最佳方法是什么? - What's the best way to log debug info in an iphone app? 在iPhone应用程序中存储(可能是数百个)字符串的最佳方法是什么? - What is the best way to store (possibly hundreds) of strings in iPhone app? 在iPhone App中提供小图像选择的最佳方法是什么? - What would be the best way of providing small image selection in an iPhone App? 我将要投放市场的加密iPhone应用程序的最佳方法是什么? - What is the best way to encrypt an iPhone App that I will put on the market?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM