无法刷新i​​Phone sqlite3数据库 [英] Can't refresh iphone sqlite3 database

查看:72
本文介绍了无法刷新i​​Phone sqlite3数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从命令行创建了一个sqlite3数据库,并插入了几条记录.我的应用程序检索了所有这些文件,并显示它们很好.然后,我再回过头来,通过sqlite3 cli插入一些记录,将db文件从模拟器的documents目录中删除,以便将其从主捆绑包中复制,然后再次运行该应用程序,仅发现它仅显示我插入的原始记录.新记录不显示.我确认新的db文件已复制到模拟器文件目录中,当我将sqlite3 cli指向它时,我可以执行select *并查看所有记录.

I've created an sqlite3 database from the command line and inserted several records. My app retrieves all of them and shows them just fine. I then go back and insert a few more records via the sqlite3 cli, erase the db file out of the simulator's documents directory so that it will be recopied from the main bundle, and the run the app again only to find that it only displays the original records I inserted. The new records do not show. I verified that the new db file was copied to the simulators documents directory, and when I point the sqlite3 cli at it, I can do a select * and see all the records.

这可能是怎么回事?几乎好像db文件的先前版本正在某个地方缓存并使用,而不是我的更新版本.

What could be going on here? It almost seems as if the previous version of the db file is being cached somewhere and used instead of my updated version.

//斯科特

推荐答案

每次使用xcode重建和运行应用程序时,它都会在iphone模拟器的apps文件夹下创建一个新文件夹.如果您的sqlite数据库已包含在xcode中,则旧数据库可以放在新文件夹中,而您编辑的数据库则位于旧的现在未使用的文件夹中.

every time you rebuild and run an app in xcode, it creates a new folder under the iphone simulator's applications folder. If your sqlite db is being included from xcode the old db could be put in the new folder while the one your editing is in the old and now unused folder.

这篇关于无法刷新i​​Phone sqlite3数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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