Hello. In this article I will describe the process of creating the simplest application for iOS and introducing into it the method I use to ensure correct work with the Russian (and not only) language of such SQLite constructions as UPPER / LOWER, LIKE or ORDER BY.
The described method was used when developing in Xcode 4.2 under control of OS X Lion 10.7.2.
Below is a very detailed instruction with pictures.
To start
You need to download the necessary files:
- SQLite amalgamation source codes (without autoconf) from the developer’s site (2 files in the archive)
- The files sqlite_unicode.c and sqlite_unicode.h, for example, from here
Creating a new project
Launch XCode, create a new project with a template iOS Application - Single View Application, click "Next":

')
Enter the name of the project, remove the checkmarks from all checkboxes, click "Next"

Select the directory to save the project. Is done.

Adding SQLite Support to a Project
On the left in the Project Navigator, click on the topmost element of the hierarchy to view the information and properties of our project, at the bottom click the button "Add Target"

Choose iOS Framework & Library - Cocoa Touch Static Library, click Next

Enter the name for the future library. Finish.

We take the files that we downloaded at the beginning of the article and drag them into the newly created group (libsqliteunicode) in Project Navigator
In the window that appears, tick both targets (Add to targets). Finish.

Again, open the project properties, select the created libsqlunicode from the list of targets, go to the build phases tab, expand the Link Binary with Libraries list and remove Foundation.framework from it.

Go to the build settings tab and set the value in the Preprocessor Macros parameter
SQLITE_CORE SQLITE_ENABLE_UNICODE

From the list of targets, select sqliteunicode, go to the build phases tab, expand the “Target Dependencies” list and add our libsqliteunicode to it

Work with the library.
In order for all this to work as we need, in the header file of the controller of your database you should add the lines
#import "sqlite3.h"
#import "sqlite3_unicode.h"
Before using the database, you need to call
sqlite3_unicode_load();
After finishing work with the base, we call
sqlite3_unicode_free();
Otherwise, we use our library as usual libsqlite3.dylib
A working example demonstrating the connection of the base and search through it using the Search Bar and Search Display Controller:
download (4 MB)
UPD:Option without recompiling SQLite amalgamation:
- Add a standard libsqlite3.dylib to the project.
- We add there the sqlite_unicode.c and .h files from the example in the article
- Set the preprocessor parameters to SQLITE_CORE SQLITE_ENABLE_UNICODE
- Compile
Working example with a modified version:
Download (1.5 MB)
By the way, the size of the resulting .app in the first version is 1,210,597 bytes
In the second - 266 332