D
D
Denis2017-08-05 19:08:45
Swift
Denis, 2017-08-05 19:08:45

CoreData error handling, which cases need to be handled?

Good afternoon dear ones.
Six months ago, I took up self-education and began to learn how to write under iOS. The springboard was Stanford courses from Paul Hegarty, which I consider the best source to start.
At the moment, I have released the first application and am actively working on its development. The application uses the CoreData framework and currently all data is stored on the phone. I plan to use CloudKit to sync with the cloud.
However, there is still a gap in knowledge about what kind of errors there is a need to handle when working with the database. During development, I tried to take into account all possible cases when saving and processing data in the "core" of the application, validating the data before saving it in the database, in order to avoid possible errors with duplicates, incorrect data insertion, and so on. Therefore, at the moment, almost all the code related to selecting / inserting / changing data in the database is written in try?. That is, I do not have error handling, as such. The data has been saved - good, we are working further. Not saved, well, okay, the user will see that they are not.
I ran my eyes through the Apple article - Troubleshooting Core Data, however, I have not yet received any of these errors during testing, as I try to validate everything in the code.
As far as I understand, one of the mistakes that can happen to me is the inability to save data due to lack of space. However, I don’t know how much it makes sense to handle it in the application, since iOS itself will remind the user when the place is running out.
Interested in your thoughts, comrades, based on your experience - what errors and how do you handle when working with CoreData?
Sorry for the large amount of text, I wanted to describe the situation as much as possible and did not want to go to StackOverflow with this question, the opinion of Russian-speaking colleagues is interesting. Ideally, I would like to process errors in such a way that the maximum information is saved somewhere and sent to me, as a developer, for further analysis.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question