# Databases not keying properly in iOS 10?

**URL:** <https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666>\
**Category:** SQLCipher\
**Created:** [September 9, 2016, 2:58pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666 "2016-09-09T14:58:36Z")\
**Posts on this page:** 11\
**Page:** 2

<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:** [September 14, 2016, 8:46pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/21 "2016-09-14T20:46:40Z")

</div>

@tcoyle I took a look at the build log. I didn’t see any evidence there that SQLCipher was actually being built. There should be a line there that reads “Build target amalgamation of project sqlcipher” if it is being compiled in. Is it possible that you removed the target dependency or link with library configurations while testing at some point? Can you double check the Build Phases on the application target please?

---

<div class="post-metadata">

**Author:** ![tcoyle](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@tcoyle](https://discuss.zetetic.net/u/tcoyle)\
**Post date:** [September 14, 2016, 9:04pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/22 "2016-09-14T21:04:50Z")

</div>

@sjlombardo it is the first thing listed under build phases

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/zetetic/original/1X/5780a1faf99cbe7918cd4b0c082c2d841f5290fa.png)

if it wasn’t being built why does it work if I remove the -lsqlcipher line? I keep comparing everything side by side with my SQLTest project and can’t figure out why one works and the other doesn’t.

---

<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:** [September 14, 2016, 9:45pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/23 "2016-09-14T21:45:49Z")

</div>

@tcoyle Right, the thing is it’s not really working (from a SQLCipher perspective), its just compiling. Because your main project has pods that include sqlite3 dependencies, that is being used instead. This isn’t really a supported scenario, but I was thinking this might provide some sort of workaround. I’m not sure about the difference in the projects, but if you compare the two build logs it is clear the amalgamation and sqlcipher project build steps aren’t happening.

---

<div class="post-metadata">

**Author:** ![tcoyle](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@tcoyle](https://discuss.zetetic.net/u/tcoyle)\
**Post date:** [September 14, 2016, 10:02pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/24 "2016-09-14T22:02:21Z")

</div>

@sjlombardo but if I build to a device running iOS 9 it does work properly?

---

<div class="post-metadata">

**Author:** ![tcoyle](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@tcoyle](https://discuss.zetetic.net/u/tcoyle)\
**Post date:** [September 15, 2016, 6:51pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/25 "2016-09-15T18:51:20Z")

</div>

@sjlombardo so I decided to recreate my project from scratch - seeing as my sample projects worked fine and I couldn’t find any differences in build settings.

After getting further along the process I got the error again, and determined it has something to do with using different configurations/schemes.

In my main project I have a DebugDEV and DebugPROD configuration with different bundle identifiers. I have 2 schemes set up to quickly run this configurations. When building for iOS 10 - to one of this configurations - is when I receive the library not found error for sqlcipher. I added these configs and schemes to my test project and was able to reproduce the issue. I will message you a copy of the updated test project.

---

<div class="post-metadata">

**Author:** ![tcoyle](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@tcoyle](https://discuss.zetetic.net/u/tcoyle)\
**Post date:** [September 16, 2016, 2:00pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/26 "2016-09-16T14:00:57Z")

</div>

@sjlombardo alright I fixed it.

I had to add all the different configurations I use in my main project to the sqlcipher project to get it to build on iOS 10 devices. Never had to do that before - but for some reason it wasn’t building sqlcipher when building from those configs - only for iOS 10.

Thanks for the help, the -lsqlcipher lines a life saver.

---

<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:** [September 16, 2016, 3:19pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/27 "2016-09-16T15:19:10Z")

</div>

Hi @tcoyle - It’s good to hear that you were able to resolve the configuration issue. I wanted to mention briefly that while the linker changes may work, they are not without risk. It is still possible that there could be other undefined behavior due to the concurrent linking of sqlite3. Unfortunately, this isn’t really a supported scenario. If you use decide to use this approach, please be cautious and especially careful with testing. You should also review the article we recently published [about SQLCipher with XCode 8 and iOS 10](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-ios-10/1688), particularly related to the runtime verification of SQLCipher and testing.

---

<div class="post-metadata">

**Author:** ![Nirav\_Patel](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@Nirav\_Patel](https://discuss.zetetic.net/u/Nirav_Patel)\
**Post date:** [October 26, 2016, 9:42am UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/28 "2016-10-26T09:42:20Z")

</div>

Hi @sjlombardo - I am also facing one issue in sqlcipher in iOS 10.

- I have done below code to encrypt DB.

Database encryption is working perfectly.

- Now if i am going to perform any operation on database than got error “file is encrypted or is not a database”

Can you pls help me ?

---

<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:** [October 26, 2016, 2:05pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/29 "2016-10-26T14:05:39Z")

</div>

@Nirav_Patel - have you reviewed and implemented all of the guidance from the [Important Advisory: SQLCipher with Xcode 8 and new SDKs](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-ios-10/1688)?

Have you examined the database to ensure that it is actually encrypted?

---

<div class="post-metadata">

**Author:** ![Nirav\_Patel](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@Nirav\_Patel](https://discuss.zetetic.net/u/Nirav_Patel)\
**Post date:** [October 27, 2016, 5:38am UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/30 "2016-10-27T05:38:54Z")

</div>

Yes, My database is actually encrypted. But if i am going to perform any operation after encryption than got error which i send you above post.

---

<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:** [October 27, 2016, 1:47pm UTC](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666/31 "2016-10-27T13:47:46Z")

</div>

@Nirav_Patel - Did you implement all of the guidance from this article?

> [@Important Advisory: SQLCipher with Xcode 8 and new SDKs](https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-ios-10/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…

[Previous page](https://discuss.zetetic.net/t/databases-not-keying-properly-in-ios-10/1666.md?page=1)
