Question

I've followed the documentation in the Official SQLCipher Site for iOS. I imported sqlite3.h. I added openssl and sqlcipher xode.proj. They are actually all fine.

It's encrypting the databases and I can query off them. The builds are good, except for this little warning about sqlite3_key.

I can see the step by step build process of the custom script and everything is fine.

I can see in the header file that there is that SQLITE_HAS_CODEC condition for this function not present in the native sqlite3 because we're using the sqlcipher version of sqlite.

I've added the -DSQLITE_HAS_CODEC to the C Flag and C++ Flag, this is for both Project and Target Build Settings.

Overall SQLCipher works fine except for this warning:

Implicit declaration of function 'sqlite3_key' is invalid in C99

that keeps popping up during Profiling and Archiving the Binary in Xcode.

Building it via Debug doesn't throw this warning.

Is there anything that I still have to do?

Was it helpful?

Solution

I (still) assume that you have some build setting different between Debug and Release configuration (e.g. "Header Search Path"). If you can't find the problem in the Build Settings, I would recommend to inspect the preprocessed output of the source file:

  • Select the .m file that gives the warning.
  • Choose Product -> Generate Output -> Preprocessed File from the Xcode menu.
  • At the bottom of the preprocessed output window, switch between
    • "Running" (which uses the Debug configuration by default) and
    • "Profiling" (which uses the Release configuration).

In the preprocessed output, search for the sqlite3_key() declaration in both versions. You can also check if the correct version of "sqlite3.h" was included. Without a Header Search Path, there would be a line

# 1 "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/sqlite3.h" 1 3 4

With the Header Search Path correctly set up for SQLCipher, the path to "sqlite3.h" should be different, so you can check that and again compare "Running/Debug" and "Profiling/Release" output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top