Search code examples
iosswiftsqlite.swift

'SQLite.swift/SQLCipher' error: ambiguous use of 'SQLITE_DETERMINISTIC'


I'm using SQLite.swift and SQLCipher via cocoapods.

I get the error ambiguous use of 'SQLITE_DETERMINISTIC' in the SQLite.swift file: Connection.swift fails at line 590. Snippet is show below.

        var flags = SQLITE_UTF8
        #if !os(Linux)
        if deterministic {
            flags |= SQLITE_DETERMINISTIC
        }
        #endif

I can fix this by unlocking the pod file and replace 'SQLITE_DETERMINISTIC' with 'SQLCipher.SQLITE_DETERMINISTIC' or 'SQLite.SQLITE_DETERMINISTIC'. But this is bad for lots of reasons.

Steps to reproduce:

  1. Using Xcode 11.3
  2. Create a new project (Single View App is fine)
  3. Create a Podfile (example below)
  4. Run 'pod install'
  5. Open the Workspace and compile
  6. Build fails with error

Example Podfile:

use_frameworks!


target 'TestSQLite' do
    pod 'SQLite.swift/SQLCipher', '~> 0.12.2' # with SQLCipher
end

Any help would be appreciated.


Solution

  • SQLite.swift version 0.12.2 and you did not specify SQLCipher version. Please check SQLCipher version which may be 4.3.0 in Podfile.lock file. In this case, set SQLCipher version to 4.2.0. Clean and build the project. It will work. You can update pods

    pod 'SQLCipher', '~>4.2.0'

    pod 'SQLite.swift/SQLCipher', '~>0.12.0'

    Run following commands in command line

    pod deintegrate

    pod install

    Thank you