集合和amp;amp;lt;NSCFSet:0x1b0b30和amp;gt;在枚举时发生了突变.确定哪个集合?
问题说明
我正在做一堆核心数据插入,在 20k 左右插入后每 1-2k 保存一次,我收到此错误:
I'm doing a bunch of core data inserts and after 20k or so inserts with saves every 1-2k I get this error:
Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSCFSet: 0x1b0b30> was mutated while being enumerated.'
我想弄清楚是哪个 NSSet 导致了这种情况.我进行了搜索,我的代码中唯一的 NSSet 是处理核心数据关系的自动生成的.
I'm trying to figure out which NSSet is causing this. I've done a search and the only NSSets in my code are the autogenerated ones that handle the Core Data relationships.
我正在使用 NSXMLParser 并为找到的每个元素创建一个新实体(如果匹配的实体尚不存在).
I'm using NSXMLParser and for each element found creating a new entity (if a matching one doesn't already exist).
所以我将创建一个状态实体,然后填充所有城市实体,然后进行保存.这意味着一个州的 NSSet *cities 正在被添加,但我不明白你为什么不能这样做.
So I will create a state entity and then populate all the city entities and then do a save. This means that a state's NSSet *cities is getting added to but I don't see why you can't do that.
正确答案
在 objc_exception_throw
上设置断点并获取回溯.这应该表明突变期间正在枚举什么.
Set a breakpoint on objc_exception_throw
and grab a backtrace. That should indicate what is enumerating during mutation.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfjega
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20