From 34bad0183422b4dd6cf67e93d6353dfd2ab0b1bd Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Sun, 28 Oct 2012 20:26:34 -0400 Subject: [PATCH] Obtain a mutable copy of the managed object model before attempting to add indexing. fixes #1014 --- Examples/RKSearchExample/RKSearchExample/RKSAppDelegate.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Examples/RKSearchExample/RKSearchExample/RKSAppDelegate.m b/Examples/RKSearchExample/RKSearchExample/RKSAppDelegate.m index ac489148..59d659c4 100644 --- a/Examples/RKSearchExample/RKSearchExample/RKSAppDelegate.m +++ b/Examples/RKSearchExample/RKSearchExample/RKSAppDelegate.m @@ -17,7 +17,8 @@ RKLogConfigureByName("RestKit/Search", RKLogLevelTrace); // Initialize the managed object store - NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil]; + // NOTE: To add search indexing an entity, the managed object model must be mutable. The `mergedModelFromBundles:` method returns an immutable model, so we must send a `mutableCopy` message to obtain a model that we can add indexing to. + NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] mutableCopy]; RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel]; // Configure the Contact entity for mapping