Disclaimer: Not sure whether or not this is a linking issue between my project and sqlcipher, my lack of knowledge towards how a program is run when xcode is open, or if my code is incorrect.
I have a working mac osx application when it is run on xcode that encrypts and decrypts database files using sqlcipher.
The only problem is, is that when I export the program to a non-signed mac osx application or when I run the .app file made from xcode, I get the an error code 14 (Unable to open the database file) while the application is running (sqlite3open gives SQLITE_OK)
attachCmd = [NSString stringWithFormat:
@"ATTACH DATABASE \"%@\" AS outputDB KEY '%@';", outFile, key];
if ((sqlerror = sqlite3_exec(db, ((const char*) [attachCmd UTF8String]), NULL, NULL, NULL)) == SQLITE_OK) {
...
}
I am not sure whether I have static library linking issues or my code/sqlcipher's code issues.
Figured it out: my simulator had access to the sandbox while release applications did not.
So i had to add in the capabilities tab of project settings sandbox to fix this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.