SQLite is already a popular API for persistent data storage in iOS apps so the upside for development is obvious. As a programmer you work with a stable, well-documented API that happens to have many good wrappers available in Objective-C, such as FMDB and Encrypted Core Data. All security concerns are cleanly decoupled from application code and managed by the underlying framework.
- Open the Terminal, switch into your project's root directory and checkout the SQLCipher project code using Git:
- Right click on the project and choose "Add Files to "My App"" (the label will vary depending on your app's name). Since we cloned SQLCipher directly into the same folder as your iOS app you should see a sqlcipher folder in your root project folder. Open this folder and select sqlcipher.xcodeproj
Select the Build Settings pane. In the search field, type in "Header Search Paths". Double-click on the field under the target column and add the following path: $(PROJECT_DIR)/sqlcipher/src
Start typing "Other Linker Flags" into the search field until the setting appears, double click to edit it, and add the following value: $(BUILT_PRODUCTS_DIR)/libsqlcipher.a
Start typing "Other C Flags" into the search field until the setting appears, double click to edit it, and in the pop-up add the following value: -DSQLITE_HAS_CODEC
Expand Target Dependencies and click on the + button at the end of the list. In the browser that opens, select the sqlcipher static library target:
- Expand Link Binary With Libraries, click on the +button at the end of the list, and select the libsqlcipher.a library.
- Finally, also under Link With Libraries, add Security.framework.
Integration of code:
Integration to open database using password.