|
|
@@ -497,12 +497,29 @@ - (BOOL)goodConnection {
|
|
|
return NO;
|
|
|
}
|
|
|
|
|
|
+#ifdef SQLITE_HAS_CODEC
|
|
|
+ // 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;
|
|
|
}
|