small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
27 Jun 2011, 15:21
Martin Hwasser (1 post)

I’ve been trying out the -progressivelyMigrateURL:ofType:toModel:error: method from the GrokkingRecipes.

However, I’ve noticed that the code causes problems when there’s no previous database, because the metadata for the store is nil:

NSDictionary *sourceMetadata = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:type URL:sourceStoreURL error:error]; if (!sourceMetadata) { return NO; }

I’ve been working my way around this by checking in advance if a migration is actually needed, but I was curious to whether this is a bug or working as intended?

Avatarsmall_pragsmall
27 Jun 2011, 16:34
Marcus S. Zarra (284 posts)

The code works in as much as it demonstrates the prinicipals that it was itended to. There are numerous error checks that are not included to avoid clouding the focus.

I would not recommend using any code from any source directly without a complete review as most code provided in example lacks the proper error checking.

In this case, you can consider that a bug for production code.

You must be logged in to comment