0

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?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
RegisteredUser
  • 415
  • 4
  • 13

1 Answers1

1

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.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
  • Hi Martin R, This is what I get: sqlite3_key Running - line 37284 Profiling - line 37265 Header Path Running: # 4396 "sqlcipher/sqlite3.h" int sqlite3_key( sqlite3 *db, const void *pKey, int nKey ); Profiling: - There's nothing. So I tried removing: -DNS_BLOCK_ASSERTIONS=1 from Release and now it's okay in Profiling. Is this okay? Is this Flag important? – RegisteredUser Jun 06 '13 at 06:40
  • Oh, So Here's the Problem: If I leave it at Any Architecture|Any SDK for -DNS_BLOCK_ASSERTIONS=1, It Flags that Warning. But if I choose at least Any iOS SDK, it now works with -DNS_BLOCK_ASSERTIONS=1. Thanks for all the help Martin, It's all good now! – RegisteredUser Jun 06 '13 at 06:50