iPhone: Making a simple high score system using SQLite -
i want make simple highscore system game. no posting online, storing best scores on device, maybe being able share them on twitter or that.
my table this:
create table highscores ( name varchar(10), score int )
and want find easy way retrieve name, score , order score descending, returning top 5.
select name, score highscores order score desc limit 0, 5
i tried this, following sqlite tutorial: http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/
i created database, set up, tried make own wrapper, got following problems:
- it worked loading score, loading name, tried convert nsstring* in tutorial, wouldn't work, returned 0 though had set name "johannes"
- if navigated away scores page, , menu, , clicked on scores page again app crashed.
any ideas? i'm stressed can't find online this. :[
dude... overkill.
just save data in object or array, save , restore object betweens sessions use nsuserdeafults.
to order data. use predicates. failing sort self. http://developer.apple.com/mac/library/documentation/cocoa/conceptual/predicates/articles/pusing.html
seriously don't waste anytime getting app live. "fail quickly", means figure out doesn't work , run works , make awesome. nothing worse spending days/weeks on app might make few bucks.
hope help.
Comments
Post a Comment