Is there a framework or class that allows Cocoa and Objective-C to interface with a remote database, be it SQLite, MySQL, or another (though preferably SQLite)?
However, connecting to a remote DB directly from an iPhone/iPad App is a very bad idea. Imagine someone with a jailbroken iPhone and a simple packet sniffer.... It would be incredibly easy for someone to compromise the security of your Database.
The best way to acomplish this is to wrap it in php via a web server on your remote Database server. You can then run a query on the DB with a simple http POST request and have the page return xml/json/whatever.
发布评论
评论(1)
您可以下载源代码并自行编译,但我读到这很痛苦,我认为该项目可能已经死了:
CocoaMySQL-src
但是,直接从 iPhone/iPad 应用程序连接到远程数据库是一个非常糟糕的主意。想象一下,某人拥有一部越狱的 iPhone 和一个简单的数据包嗅探器……某人很容易危及您数据库的安全。
完成此操作的最佳方法是通过远程数据库服务器上的 Web 服务器将其包装在 php 中。然后,您可以使用简单的 http POST 请求在数据库上运行查询,并让页面返回 xml/json/whatever。
You can download the source and compile this yourself but I have read that it is a pain and I think the project may be dead:
CocoaMySQL-src
However, connecting to a remote DB directly from an iPhone/iPad App is a very bad idea. Imagine someone with a jailbroken iPhone and a simple packet sniffer.... It would be incredibly easy for someone to compromise the security of your Database.
The best way to acomplish this is to wrap it in php via a web server on your remote Database server. You can then run a query on the DB with a simple http POST request and have the page return xml/json/whatever.