# Use of unresolved identifier 'sqlite3\_key' in XCode 9 iOS 11

**URL:** <https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457>\
**Category:** SQLCipher\
**Created:** [November 5, 2017, 11:43pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457 "2017-11-05T23:43:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdleung](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jdleung](https://discuss.zetetic.net/u/jdleung)\
**Post date:** [November 5, 2017, 11:43pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/1 "2017-11-05T23:43:39Z")

</div>

My project written in Swift has been using SQLCipher from the App’s first version, It really did a good job until I recently upgrade it to XCode 9 to support iOS 11. It shows errors " Use of unresolved identifier ‘sqlite3\_key’".

I had repeated the install instruction for more than 3 times, and also a totally new installation, SQLCipher still refuses to work.

Other C Flag checked, ‘#define SQLITE\_HAS\_CODEC 1’ and ‘#import \<sqlite3.h\>’ are both in bridge file.

Did I miss any step that need to change for XCode 9?

Thanks.

By the way, I have another new project written in Objective-C. After cloning SQLCipher project code using Git, it shows error **Implicit declaration of function ‘sqlite3\_key’ is invalid in C99** , I found some files are in red which means not found in the project.

Source

- **sqlite3.c**
- **sqlite3.h**

FrameWorks

- **Security.framesorks** (All)

Products

- **SQLCipher.framesorks** (All)

I had to copy the old files from old project to make it works.

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [November 6, 2017, 2:06pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/2 "2017-11-06T14:06:38Z")

</div>

Hello @jdleung - please check out this information on using SQLCipher with XCode 9:

> [@Important Advisory: SQLCipher with Xcode 9 and new SDKs](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-9-and-new-sdks/2371):
>
> Apple has recently released Xcode 9, along with new SDKs (e.g. iOS 11, watchOS 4, etc), with new features and enhancements. Most projects that include recent versions of SQLCipher shouldn’t have any problems upgrading. However, there are some changes in the SDKs, so we have prepared important recommendations for SQLCipher developers that run into errors after upgrading. Note: Before proceeding, be sure that all projects implement the separately documented [recommended changes related to SQLCiphe…](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-new-sdks/1688)

---

<div class="post-metadata">

**Author:** ![jdleung](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jdleung](https://discuss.zetetic.net/u/jdleung)\
**Post date:** [November 7, 2017, 8:34am UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/3 "2017-11-07T08:34:41Z")

</div>

@sjlombardo, I followed your instruction to use the following code to test if SQLCipher is running, I got “true”, but if I used **‘sqlite3\_key’** again the error **Use of unresolved identifier ‘sqlite3\_key’** happened. The settings is as same as the Objective-C project, but it fails in Swift. In the same project, database without encrypted can be opened without any error.

```
var is_sqlcipher = false;
    var stmt:OpaquePointer? = nil;
    if(sqlite3_prepare_v2(db, "PRAGMA cipher_version;", -1, &stmt, nil) == SQLITE_OK) {
        if(sqlite3_step(stmt) == SQLITE_ROW) {
            let ver = sqlite3_column_text(stmt, 0);
            if(ver != nil) {
                is_sqlcipher = true;
            }
        }
        sqlite3_finalize(stmt);
    }
    print("is sqlcipher: \(is_sqlcipher)")
```

---

<div class="post-metadata">

**Author:** ![jdleung](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jdleung](https://discuss.zetetic.net/u/jdleung)\
**Post date:** [November 7, 2017, 1:04pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/4 "2017-11-07T13:04:24Z")

</div>

@sjlombardo, I create a new project in Swift, SQLCipher runs without error.😂

I think there is other sqlite reference in the project, but libsqlite3.dylib had been removed before, and the project has run well before upgrading to XCode 9.

Any other frameworks must be removed?

Thanks.

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [November 7, 2017, 10:45pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/5 "2017-11-07T22:45:06Z")

</div>

Hello @jdleung - if there are other components that reference SQLite, you should take a look at this guidance as well related to the link ordering.

> [@Important Advisory: SQLCipher with Xcode 8 and new SDKs](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-new-sdks/1688):
>
> Note: Updated to clarify that this guidance applies to all projects built with Xcode 8, including for non-iOS targets). Apple has recently released XCode 8, along with new SDKs (e.g. iOS 10, watchOS 3, mac OS, tvOS), with many new features and enhancements. The majority of projects that include SQLCipher should have no problems after upgrading. However, there are some important changes and edge cases, so we have prepared the following important recommendations for all SQLCipher developers upgra…

This isn’t specific to XCode 9, but it sounds like you might have some cross dependencies that might need to be addressed.

---

<div class="post-metadata">

**Author:** ![jdleung](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jdleung](https://discuss.zetetic.net/u/jdleung)\
**Post date:** [November 8, 2017, 2:23pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/6 "2017-11-08T14:23:22Z")

</div>

Hello @sjlombardo, thanks your guidance, the project do has two CocoaPods frameworks. I tried to remove them and then reinstall them with the latest version, SQLCipher works now.

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [November 8, 2017, 3:06pm UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/7 "2017-11-08T15:06:11Z")

</div>

Hello @jdleung - It’s good to hear that things are working for you. Just to clarify, did you upgrade the other Pods, reorder your pods in the spec, or do something else?

As an aside, it would be a good idea to implement the runtime checks mentioned in the above articles.

---

<div class="post-metadata">

**Author:** ![jdleung](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jdleung](https://discuss.zetetic.net/u/jdleung)\
**Post date:** [November 9, 2017, 3:31am UTC](https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key-in-xcode-9-ios-11/2457/8 "2017-11-09T03:31:42Z")

</div>

Hi @sjlombardo, I just removed and upgraded all the Pods without reordering.
