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



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"}


For anyone else looking to integrate SQLCipher via FMDB using swift, FMDB has merged my pull request which now takes care of adding SQLCipher to the header search paths, so it should work out of the box without need for a post_install hook.

If you’re directly using the SQLCipher pod and swift, you’ll need to either adjust the bridging header to be #include <SQLCipher/sqlite3.h> or add $(PODS_ROOT)/SQLCipher to the HEADER_SEARCH_PATHS of your application. We’re planning on adjusting the podspec for SQLCipher to account for this in the next point release.


This didn’t work for me but the previous version did



Glad to hear one of the post install hooks worked to properly set the SQLCipher header search paths for FMDB.

I’m not sure on FMDB’s plans on which version the adjustment will be included in, but it’s this commit off of master which merges in my Pull Request which accomplishes the same thing as this post_install hook:

Specifying this commit within the Podfile should eliminate the need for the post_install hook – i.e.:

pod 'FMDB/SQLCipher', :git => '', :commit => '18152d3ea819d5a65a682ad9f3b22dbbb3c2423e'



Awesome, resolved issue for me.

XCode 9.4.1

pod ‘FMDB/SQLCipher’, ‘2.7.2’