diff options
Diffstat (limited to 'src/fmdb/FMDatabase.m')
-rw-r--r-- | src/fmdb/FMDatabase.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fmdb/FMDatabase.m b/src/fmdb/FMDatabase.m index e91a09b..332ec07 100644 --- a/src/fmdb/FMDatabase.m +++ b/src/fmdb/FMDatabase.m @@ -497,12 +497,29 @@ static int FMDBDatabaseBusyHandler(void *f, int count) { return NO; } +#ifdef SQLCIPHER_CRYPTO + // Starting with Xcode8 / iOS 10 we check to make sure we really are linked with + // SQLCipher because there is no longer a linker error if we accidently link + // with unencrypted sqlite library. + // + // https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-new-sdks/1688 + + FMResultSet *rs = [self executeQuery:@"PRAGMA cipher_version"]; + + if ([rs next]) { + NSLog(@"SQLCipher version: %@", rs.resultDictionary[@"cipher_version"]); + + [rs close]; + return YES; + } +#else FMResultSet *rs = [self executeQuery:@"select name from sqlite_master where type='table'"]; if (rs) { [rs close]; return YES; } +#endif return NO; } |