Software engineer by profession, iOS developer by chance, freelancer by luck, Photographer by hobby and dad for my son


If the file is found but the parse simply produces a nil parse tree, the NS_VALUERETURN macro is used to return nil to the readDataFile: caller. Note that it is not allowed to simply write “return nil;” inside the NS_DURING block, owing to the nature of the behind-the-scenes C constructs implementing the mechanism (the setjmp() and longjmp() functions). If you are in a void function not returning a value, you may use simply “NS_VOIDRETURN” instead.

Backstage with Nested Managed Object Contexts — Florian Kugler

All other objects can just be ignored, because they cannot be in use anyway. When importing large amounts of data on a background context, this behavior makes total sense. After all, most of the changed objects won’t be of interest to the context in the main thread.

There is not one correct way to use Core Data as data models vary a tremendous amount from app to app. You should always start with the most basic Core Data stack, which includes a single managed object context on the main queue. Don’t deviate from this stack until you encounter a performance problem.