iOS永久商店问题 [英] iOS Persistent store issue

查看:71
本文介绍了iOS永久商店问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将核心数据与预加载的sqlite数据库一起使用。我遇到一个奇怪的问题,该应用程序可在模拟器上运行,但是当我尝试在设备(例如iPad,出现以下错误。 :无法识别的选择器发送到实例0x3bebf50'

我从模型中重新创建了sqlite数据库,并重新填充了数据库,但我仍然遇到相同的错误。我已经检查了构建阶段部分中的编译源和复制捆绑资源,并且文件都在那里。



代码:
http://pastebin.com/fTTgEA3W



我喜欢大脑,似乎无法理解为什么它不起作用,任何帮助将不胜感激。



感谢您的时间,如果您需要更多信息,请让我

解决方案

第一个措施:删除该应用并重新安装。



第二个方法:在代码中搜索 persistentStore 的文本搜索。显然它要去的地址是 NSManagedObjectContext ,它没有此方法。如果发现错误,请更正。



第三步:检查娱乐算法,以确保正确建立商店。在我的大型商店项目中,如果需要从原始数据导入商店,通常会打开一个 SETUP 标志,由于存在以下原因,通常只能在模拟器中使用该标志:内存需求。 (当 SETUP 关闭并且没有存储时,先前生成的存储将被复制。)也许在iPad上您没有足够的内存来进行数据导入。 / p>

I am using core data with preloaded sqlite database. I am encountering a strange issue, the app works on the simulator, but when I try run it on a device, e.g. iPad, I get the error below.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject persistentStore]: unrecognized selector sent to instance 0x3bebf50' 

I recreated the sqlite database from the model and repopulated the database, but I still get the same error. I've checked the 'Compiled Sources' and 'Copy Bundle Resources' in the build phase section and the files are all there.

Code: http://pastebin.com/fTTgEA3W

Been racking my brain and can't seem to understand why it's not working, any help would really be appreciate.

Thank you for your time and if you need any more information please let me know.

解决方案

First measure: delete the app and reinstall.

Second measure: text search for a call to persistentStore in your code. It is apparently going to an address that is a NSManagedObjectContext which does not have this method. Fix the error if you find it.

Third measure: review your recreation algorithms to make sure you are building the store correctly. In my projects with big stores, I usually have a SETUP flag that I switch on if the store needs to be imported from raw data, which normally works only in the simulator because of the memory needs. (When SETUP is off and there is no store, the one generated previously is copied over.) Maybe on the iPad you do not have enough memory to do the data import.

这篇关于iOS永久商店问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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