Reputation: 1324
I'm writing a game for iPhone, and I want an online leaderboard using mySQL, which i'm very familiar with. How do I implement this in my app? I would assume there's a framework/library i need to obtain?
Upvotes: 0
Views: 2283
Reputation: 4800
You should abstract the DB technology from the app, wrap your MySQL DB with a simple web service and run it on a web server, then you can use standard HTTP requests to interact with your database from your app.
My suggestions (not by any means the only way to do this)...
Now you have a publicly accessible leaderboard server that your app can interface with by posting scores and retrieving data through simple socket HTTP calls.
Upvotes: 0
Reputation: 6126
This may be outside your scope, but have you considered using OpenFeint instead to do Leaderboards and more? There's no actual framework/library from Apple to create a leaderboard in GameKit. You have to write one yourself from scratch. Although, using the OpenFeint library would give you all this for you, but that's if you want to use it.
More information here on a tutorial to do just what you're asking. http://icodeblog.com/2009/10/29/iphone-coding-tutorial-creating-an-online-leaderboard-for-your-games/
Upvotes: 0
Reputation: 118691
You don't.
You most certainly DO NOT want to expose and publish your database connection to the "live" internet. That's simply folly.
The database listeners simply aren't designed to work over such an unrestricted domain. They tend to live sheltered lives.
Instead, you should front your database with another service that IS designed for the wilds of the internet. This service can handle the authentication, encryption, load balancing, etc. requirements that good internet servers support.
Most folks today use some variant of web service, posting XML or JSON, but you can do whatever you want.
But don't open the DB connection to the live internet. You're just asking for trouble.
Upvotes: 3