The second game we have is a "skeet shooting" game where discs are fired in the air and the goal is to shoot as many down as possible within a certain time limit. For this game, we will persist hi-score data using a SQLite database. We will be using the FMDB Objective-C SQLite wrapper to access the SQLite database within our code and the Firefox plugin SQLite Manager to create an initial database file.
Please refer to the project RecipeCollection01 for full working code of this recipe. For the sake of brevity, all game logic has been omitted from the following code.
To use SQLite we first need to do a few things:
First we need to add the
libsqlite3.0.dylib
framework. You can do this by right clicking on your project and going to Add > Existing Frameworks and then, under iOS 4.x SDK, selectinglibsqlite3.0.dylib
.Next, we need to add the FMDB Objective-C SQLite wrapper to our project. FMDB can be downloaded here: https://github...