菜鸟教程小白 发表于 2022-12-12 09:36:42

ios - 如何在默认的 xcode 应用程序中使用 sqlite 密码?


                                            <p><p>我是 <code>sql cipher</code> 的新手,并尝试了 <code>sql cipher</code> 演示应用程序的链接。
但是当我运行应用程序时,它总是输入以下代码的 <code>else</code> 部分。</p>

<pre><code>sqlite3_key(sqlite3Database, key, (int)strlen(key));
if (sqlite3_exec(sqlite3Database, (const char*) &#34;SELECT count(*) FROM sqlite_master;&#34;, NULL, NULL, NULL) == SQLITE_OK)
{
    NSLog(@&#34;Password is correct, or a new database has been initialized&#34;);
} else {
    NSLog(@&#34;Incorrect password!&#34;);
}
</code></pre>

<p>我已经有一个数据库说 <code>sqlDatabase.sql</code>。现在我想加密它,但这不起作用。
有人可以帮忙吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>如果您的纯文本 SQLite 数据库已经存在,您将需要执行 <code>sqlcipher_export(…);</code> 操作以使用 SQLCipher 对其进行加密。更多信息可以在文档 <a href="https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlcipher_export" rel="noreferrer noopener nofollow">here</a> 中找到。 .</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在默认的 xcode 应用程序中使用 sqlite 密码?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/33411556/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/33411556/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在默认的 xcode 应用程序中使用 sqlite 密码?