Proper way to deal with unique constraint exception

≡放荡痞女 提交于 2019-12-11 05:36:58

问题


So I'm downloading a JSON dataset from a webservice and storing them in core data after parsing. One of the entities has unique constraint set, as I don't want redundunct data in the entity. This causes "NSConstraintConflict" exception to be thrown whenever an entry value is already existed in the Core Data. Right now, I'm not handling this exception and let it be thrown. Is it a proper way to handle this situation or is there a better way?

来源:https://stackoverflow.com/questions/46076841/proper-way-to-deal-with-unique-constraint-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!