Including SQLite

Our initial work involves configuring our Xcode project with references to the SQLite library. The first step is to add a new "framework" to the project.

■NOTE This process is quite complicated in the Xcode 4 beta that I'm using—it's possible that this will be made slightly easier in the production version. Refer to the web site if these steps seem to bear no relation to your edition of Xcode.

In the Project Navigator, click on the project entry at the top of the tree. This is the blue box titled SixBookmarks. You will see a view like the one in Figure 10-10.

PROJECT_

TARGETS

•A SixBookmarks

Info

SDK and Deployment Target iOS Targets

© Recommended ' 1 Custom

Build Settings

Deployment Target

"V

Configurations

Configurations

Configuration

Based on Configuration File

► Debug

No Configurations Set

* Release

No Configurations Set

+

Localizations

Language

Resources

English

3 Files Localized

+

Figure 10-10. The project settings view

On the left, select the SixBookmarks entry under Targets. You will see something like Figure 10-11.

Figure 10-11. The target details view for "SixBookmarks"

At the top of the right-hand pane, select Build Phases. You can then expand an entry called Link Binary With Libraries. It's this entry that specifies the frameworks that you wish to include in your project. Figure 10-12 illustrates.

SixBookmarks No Selection -4 fc-

PROJECT

Info Build Settings

Build Phases

Build Rules

^ SixBookmarks

_5_

i TARGETS

Target Dependencies (0 items)

a^^ i Jl* Ja ff'a.'l 'niX^BMBt

Compile Sources <29 items)

Link Binary With Libraries (3 items)

__j Foundation.framework

1 CoreCraphics.framework

Required J Required I Required I

+

Copy Bundle Resources (S items)

Figure 10-12. The current packages related to the "SixBookmarks" target

Click the Add button and add a reference to libsqlite3.dylib. Figure 10-13 illustrates.

Choose frameworks and libraries to add Q. sqlite

J Iibsqlite3.0.dylib

Add Other. Cancel ( Add

Figure 10-13. Searching for the SQLite framework

When you click Add you'll be shown a confirmation window. Click Finish and the framework will be added. You're now ready to use SQLite in the project.

0 0

Post a comment

  • Receive news updates via email from this site