1

I've built 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?

2
  • I presume this is a remote database on a web server somewhere? Commented Jan 3, 2011 at 18:21
  • yes, exactly. Any way to go about it? Commented Jan 3, 2011 at 18:25

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.