Skip to Content
Beginning iOS 5 Application Development
book

Beginning iOS 5 Application Development

by Wei-Meng Lee
January 2012
Beginner content levelBeginner
655 pages
16h 35m
English
Wrox
Content preview from Beginning iOS 5 Application Development

LINKING TO THE SQLITE3 LIBRARY

To use a SQLite3 database in your application, you first need to add the libsqlite3.dylib library to your Xcode project. The following Try It Out demonstrates how. You will need to download the code files indicated for this exercise and the rest of the Try It Out features in this chapter.

TRY IT OUT: Preparing Your Project to Use SQLite3

image

  1. Using Xcode, create a new Single View Application (iPhone) project and name it Databases. Use the project name as the Class Prefix. Ensure that you have the Use Automatic Reference Counting option unchecked.
  2. Select the project name and then click the Build Phases tab on the right (see Figure 11-1). Click the “+” button shown in the Link Binary with Libraries section to add the libsqlite3.dylib library to it. After this, the library will be added to the project (see Figure 11-2).

    image

    FIGURE 11-1

    image

    FIGURE 11-2

  3. In the DatabasesViewController.h file, declare a variable of type sqlite3, as well as a few methods (see the code in bold). You will define the various methods throughout this chapter.
    #import <UIKit/UIKit.h>
    #import “sqlite3.h”
    
    @interface DatabasesViewController : UIViewController
    {
        sqlite3 *db;
    }
    
    -(NSString *) filePath; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Donny Wals
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9781118144251Purchase book