Proper way to deal with unique constraint exceptio

2019-07-29 05:41发布

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?

0条回答
登录 后发表回答