开发者

Abstraction layer between iphone and database

开发者 https://www.devze.com 2023-02-02 00:36 出处:网络
I\'ve buil开发者_JAVA百科t a backend in python that posts data to the database.I want a layer of abstraction, so I thought that the best thing to do was to call a python function from objective-c.The

I've buil开发者_JAVA百科t a backend in python that posts data to the database. I want a layer of abstraction, so I thought that the best thing to do was to call a python function from objective-c. The python function would then post to the database. How can this be done?


You'll need to access the Python function via a web server (potentially using an intermediate scripting language to call the Python script). You can read more about this via http://docs.python.org/howto/webservers.html

Being honest, it may prove to be less hassle to simply use a more common web scripting language (i.e.: not Python) if this is an option.

Moving on, in terms of the iPhone-side activity, you'll need to :

  1. Ensure there's a network connection available to the remote site in question. (There's a plethora of questions here on Stack Overflow, such as: Determining Internet Availability on iPhone?)

  2. Open a request to the remote web server. The NSURLRequest class should be ideal for this.

  3. Handle the results of the above correctly.

0

精彩评论

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