iOS 11 / Xcode issue - Implicit declaration of function 'sqlite3_key' is invalid in C99


Hi @sjlombardo, @wgray,

I have the same issue Implicit declaration of function 'sqlite3_key' with Xcode 9, probably it can not find the header, any suggestion?



Hi @Steven.H.A sorry to hear it. Without knowing the method you are using to include SQLCipher in your project I can’t offer much help. Please have a look at the following resource, and ensure that the sqlite3.h file for your build of SQLCipher is in your project structure and available through the Header Search Paths setting:

That article summarizes the various ways this can happen and offers several work-arounds and things to check.


@Steven.H.A I just thought of one other thing to check—that your app is not linking against another version of SQLite, like libsqlite3.0.dylib.


Hi @wgray,
Thanks, actually the problem was sqlite3.h wasn’t show in project structure. I resolved by downloading with pod. Thanks.



I have xCode 9.2 and Unable to build successfully. I am getting Build Failed. And when I am checking Build Log. I am facing issue with “Implicit declaration of function ‘sqlite3_key’ is invalid in C99”.

I am awaiting for the reply.

Please help me out.


@tejasp-excellence - please review the following two articles (in order) and make sure that all of the recommendations are implemented.


I have implemented all of the recommendations based on these articles but still, I am unable to build successfully.

Please help me out.


Hello @tejasp-excellence based on the error XCode is either not finding the sqlite3.h file (i.e. because the header search paths are incorrect), or the define is not configured properly. If you would like further help you would need to post the output of ls -R from the top level of your project along with the full Xcode build log out to a GitHub gist and then provide the link here.


Recommended Settings applied.


Header Search Paths


Other Linker Flags


Quick and dirty solution to get it running would be to add “-Wno-implicit-function-declaration” in other warning flags of build settings. Fact is it is being considered as error now. Adding this flag will force compiler to ignore it.


Downgrade Cocoapods from the current version you are using, that is what is causing the issue.
I have downgraded Cocoapods version to 1.2.1 works.

It works for me!:+1:


I upgraded cocaopods to 1.5.1 and now i have same problem.
Hack with post_install, does not work now.

post_install do | installer |
    print "SQLCipher: link Pods/Headers/sqlite3.h"
    system "mkdir -p Pods/Headers/Private && ln -s ../../SQLCipher/sqlite3.h Pods/Headers/Private"


Thank you for the advice! Downgrade cocaopods to 1.4.0 works for me.
But i hope that SQLCipher will resolve this problem for the last cocaopods version.

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.4.0


Hi @mezhevikin @prakash_adabala @Anjum_Shrimali

I’m assuming you are using swift (with use_frameworks! in the Podfile)

This issue is related to Xcode not being able to find the sqlite3.h file as @sjlombardo alluded to. I was able to get it working with the latest version of cocoa pods (1.5.2) and Xcode (Version 9.3 (9E145)) by adding the path to the SQLCipher copy of sqlite3.h to the Header Search Paths: Pods/SQLCipher


You should no longer need to use the post_install hook if you add this Header Search Path.

Let me know if that works for you guys.


Hi @mmoore! Yes, i use swift 4 with use_frameworks!. Xcode 9.3.1 and cocapods 1.5.2.
I created empty swift project and I followed your recommendations.
It does not work for me.

Demo project -

What is wrong?



You’re using SQLCipher via FMDB, so it looks like the FMDB code isn’t able to properly locate the SQLCipher copy of sqlite3.h

Try putting this post_install hook in your Podfile in the place of the previous one:

post_install do |installer|
      installer.pods_project.targets.each do |target|
          if == "FMDB"
              config_path = target.build_configurations[0].base_configuration_reference.real_path
    , "a") {|file| file.write("HEADER_SEARCH_PATHS = SQLCipher")}

then pod install again and see if it builds without errors.

Here’s an example of a Podfile that seemed to work fine for me:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'testPodFMDB' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    # Pods for testPodFMDB
    pod 'FMDB/SQLCipher'
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            if == "FMDB"
                config_path = target.build_configurations[0].base_configuration_reference.real_path
      , "a") {|file| file.write("HEADER_SEARCH_PATHS = SQLCipher")}

Let me know if this resolves it for you.


@mmoore Thank you a lot!
It works excellent.

SQLCipher and iOS 12


Great. Glad it’s working for you!

I’ve re-worked the previous post_install a bit to modify the build settings rather than appending to the xcconfig file (which I think is a bit better of a solution). It should accomplish the same thing (making sure SQLCipher is in the Header Search Paths so the proper sqlite3.h can be found by FMDB):

post_install do |installer|
        installer.pods_project.targets.each do |target|
            if == "FMDB"
               target.build_configurations.each do |config|
                   header_search = {"HEADER_SEARCH_PATHS" => "SQLCipher"}