Libsqlcipher encryption not available (app not built with SQLCipher)

I’m encountering the below when I implement database encryption:

CBL_SQLiteStorage: encryption not available (app not built with SQLCipher) {at -[CBL_SQLiteStorage decryptWithKey

I just followed the instructions here:
http://developer.couchbase.com/documentation/mobile/1.3/guides/couchbase-lite/native-api/database/index.html#story-h2-3

Kindly help. Thanks!

Which platform are you encountering this error message on?

What libraries is your app target linking with? In the target settings select the Build Phases tab, then flip open Link Binary With Libraries.

The list needs to include the libsqlcipher.a that you added to the project, and NOT libsqlite3.dylib or libsqlite3.tbd.

I’m developing in iOS

Here’s my current settings:

Where’s Couchbase Lite?

I’m sorry, what do you mean?
Based from the documentation, I only did below instruction to enable encryption…

Not sure if this is what you mean, anyway, I just imported couchbase lite (based from the documentation on installing couchbase). Since i’m developing using ios swift, import is in my bridging header…

It’s odd that you are not linking with the CouchbaseLite.framework file in the image you showed. How are you accessing any of the Couchbase Lite API otherwise? I think you may have added libsqlcipher.a to a different target by mistake than the project you are building that uses Couchbase Lite.

Couchbase lite was installed via cocoapods:
pod 'couchbase-lite-ios', '1.3.1'
then imported through the bridging header…

The version on Cocoapods forces linking to sqlite3 instead of sqlcipher (and for some reason it does it in a way that I can’t seem to stop). Since you’ve already downloaded the SDK anyway, forget CocoaPods and just link directly to the CouchbaseLite.framework and libsqlcipher.a that is included in the SDK. Alternatively, find someone who knows about CocoaPods to tell you how to make it stop forcing that linker flag (removing from the xcconfig file does not seem to be enough).

I hate CocoaPods… ):

To use CBL with SQLCipher via Cocoapods, you can do like this:

pod 'couchbase-lite-ios', '1.3.1'
pod 'couchbase-lite-ios/SQLCipher', '1.3.1'
2 Likes

@jamiltz Looks like something to add to the encryption docs.

Done http://developer.couchbase.com/documentation/mobile/1.3/installation/ios/index.html#cocoapods

1 Like

I already linked libsqlcipher.a through Link Binary with libraries.
I also did @pasin 's suggestion, install also SQLCipher through cocoapods.

Then based from the documentation, I also added this:

Above code is also seen in the AppDelegate of Todo sample app.

But i’m getting “Use of unresolved identifier ‘Couchbase’”…
What else am i missing?

Thanks in advance!

Pasin’s suggestion worked for me. Be sure to clean your project. If that doesn’t work try creating the project again maybe. That call you mentioned is not for iOS, it is for .NET (as noted by the fact that it is under the “Windows” heading)