试图在iPhone应用程序更新中覆盖sqlite数据库 [英] Trying to overwrite sqlite database in iPhone app update

查看:123
本文介绍了试图在iPhone应用程序更新中覆盖sqlite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与大多数开发人员不想覆盖sqlite数据库中的数据的sqlite应用程序不同,我正在尝试启用应用程序以覆盖未来更新的所有数据。 sqlite数据库将具有完全相同的名称并具有相同的表,我只是希望能够更新数据库中包含的数据,而无需用户删除应用程序并重新安装它。有没有一种简单的方法可以做到这一点?

Unlike most sqlite apps where developers don't want to overwrite data in a sqlite database, I'm trying to enable an app to overwrite all data with future updates. The sqlite database will have the exact same name and have the same tables, I just want to be able to update the data contained in the database without making users delete the app and reinstall it. Is there an easy method to do this?

提前致谢!

推荐答案

SQLite数据库文件只是普通文件,因此不需要特殊步骤。获取文件的路径或URL,并使用NSFileManager的 -removeItemAtPath:error: -removeItemAtURL:error:。然后以与创建旧数据库相同的方式创建新数据库。

A SQLite database file is just a normal file, so no special steps are needed. Get the path or URL to the file, and use NSFileManager's -removeItemAtPath:error: or -removeItemAtURL:error:. Then create the new database the same way you created the old one.

这篇关于试图在iPhone应用程序更新中覆盖sqlite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆