10.5 + Core Data project error?

  • When I create a fresh, new Core Data Application project with an empty
    data model, I get error messages from the application.

    When I run it, I get the following error message when I select the
    Edit menu:

    "The model configuration used to open the store is incompatible with
    the one that was used to create the store."

    I then add an NSToolbar, to which I add an NSToolbarItem (which is a
    custom view containing an NSSearchField).

    When I click inside the NSSearchField, I get the same error message.

    When I modify:

    - (NSManagedObjectModel *) managedObjectModel

    ...to replace:

    managedObjectModel = [[NSManagedObjectModel
    mergedModelFromBundles:nil] retain];

    ...with:

    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    [NSBundle mainBundle]] retain];

    ...I no longer get the error message.

    However, in the Console, I get the following error:

    2007-10-31 08:44:47.640 Cino[15909:10b] *** -[NSBundle
    countByEnumeratingWithState:objects:count:]: unrecognized selector
    sent to instance 0x30cad0
    2007-10-31 08:44:47.641 Cino[15909:10b] *** -[NSBundle
    countByEnumeratingWithState:objects:count:]: unrecognized selector
    sent to instance 0x30cad0

    when I click inside the search field, or select the Edit menu.

    Is there something I am missing in the setup procedure when creating a
    blank, new Core Data application? I'd like to know where the error
    message.

    Regards,
    Alex

    ..............................................................
    Alex Reynolds, M. Biot.
    Sr IT Specialist
    217 Leidy Building / 6013
    Department of Biology
    University of Pennsylvania
    Philadelphia, PA 19104

    V: +1 215 573.2818
    F: +1 215 898.8780
    E: mailto:<reynolda...>
    W: http://www.bio.upenn.edu/computing/
  • On Oct 31, 2007, at 8:53 AM, Alex Reynolds wrote:

    > managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    > [NSBundle mainBundle]] retain];
    >
    > ...I no longer get the error message.
    >
    > However, in the Console, I get the following error:
    >
    > 2007-10-31 08:44:47.640 Cino[15909:10b] *** -[NSBundle
    > countByEnumeratingWithState:objects:count:]: unrecognized selector
    > sent to instance 0x30cad0
    > 2007-10-31 08:44:47.641 Cino[15909:10b] *** -[NSBundle
    > countByEnumeratingWithState:objects:count:]: unrecognized selector
    > sent to instance 0x30cad0

    -mergedModelFromBundles: wants an NSArray of bundles; you are passing
    it a single NSBundle.

    Jim
  • On Oct 31, 2007, at 5:53 AM, Alex Reynolds wrote:

    > When I create a fresh, new Core Data Application project with an
    > empty data model, I get error messages from the application.
    >
    Are you doing anything else before the first build (e.g. adding other
    frameworks)?

    > When I modify:
    > - (NSManagedObjectModel *) managedObjectModel
    > ...to replace:
    > managedObjectModel = [[NSManagedObjectModel
    > mergedModelFromBundles:nil] retain];
    > ...with:
    > managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    > [NSBundle mainBundle]] retain];
    >
    NSArray bundleArray = [NSArray arrayWithObject:[NSBundle mainBundle]];
    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    bundleArray] retain];

    (Mea culpa earlier -- code typed in Mail...)

    mmalc
  • On Oct 31, 2007, at 9:04 AM, mmalc crawford wrote:

    > Are you doing anything else before the first build (e.g. adding
    > other frameworks)?

    No, nothing at all. Just a fresh Core Data Application project.

    I am building the project just after creating it, to make sure things
    are working properly before I begin to work on the data model and
    access methods.

    The same error happens with a "Quartz Composer Core Data Application"
    project, as well.

    I tried your suggestion:

    > NSArray bundleArray = [NSArray arrayWithObject:[NSBundle mainBundle]];
    > managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    > bundleArray] retain];

    ...but I get 4 compilation errors from this code:

    > NSArray bundleArray = [NSArray arrayWithObject:[NSBundle mainBundle]];

    error: invalid initializer
    error: statically allocated instance of Objective-C class 'NSArray'
    error: statically allocated instance of Objective-C class 'NSArray'

    > managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    > bundleArray] retain];

    error: incompatible type for argument 1 of 'mergedModelFromBundles:'

    When I try the following:

    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    [NSArray arrayWithObject:[NSBundle mainBundle]]] retain];

    I don't get compilation errors, but I get the same "The model
    configuration used to open the store is incompatible with the one that
    was used to create the store".

    Regards,
    Alex

    ..............................................................
    Alex Reynolds, M. Biot.
    Sr IT Specialist
    217 Leidy Building / 6013
    Department of Biology
    University of Pennsylvania
    Philadelphia, PA 19104

    V: +1 215 573.2818
    F: +1 215 898.8780
    E: mailto:<reynolda...>
    W: http://www.bio.upenn.edu/computing/
  • On Oct 31, 2007, at 6:19 AM, Alex Reynolds wrote:

    > I tried your suggestion:
    >
    >> NSArray bundleArray = [NSArray arrayWithObject:[NSBundle
    >> mainBundle]];
    >> managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    >> bundleArray] retain];
    > ...but I get 4 compilation errors from this code:
    >
    >> NSArray bundleArray = [NSArray arrayWithObject:[NSBundle
    >> mainBundle]];
    > error: invalid initializer
    > error: statically allocated instance of Objective-C class 'NSArray'
    > error: statically allocated instance of Objective-C class 'NSArray'
    >
    Well, this was written in Mail at 6:04am after about 4 hours of poor
    sleep...

    NSArray *bundleArray = [NSArray arrayWithObject:[NSBundle mainBundle]];
            ^

    > managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
    > [NSArray arrayWithObject:[NSBundle mainBundle]]] retain];
    > I don't get compilation errors, but I get the same "The model
    > configuration used to open the store is incompatible with the one
    > that was used to create the store".
    >
    How did you create the original store?
    If you created the store with another model (that included a model
    from perhaps another framework) then you won't be able to open it with
    a new model...

    mmalc
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today