Sub-classing NSAtomicStore

  • Hi All,

    Has any one had any luck working with the AutomicStoreSubclass example.  I
    need to manage and AtomicStore and thought that I would be able to use the
    AutomicStoreSubclass example as a road-map.  When I
    addPersistentStoreWithType as follows -

        if ([coordinator addPersistentStoreWithType:@"AtomicStore"
    configuration:nil URL:url options:storeOptionsDict error:&error])

    I get the following error -

    Error Domain=NSCocoaErrorDomain Code=134010 UserInfo=0x162240 "The store
    type is inconsistent with the data format."

    Anyone know of any gotchas when subclassing NSAtomicStore?

    Todd
  • Todd -

    I'd suspect one of two things:

    1) Your store's metadata method isn't returning the same identifier
    (ie @"AtomicStore") you're passing to addPersistentStore, so the
    coordinator thinks the store isn't what the caller of
    addPersistentStore said it would be
    2) Your store's metadata method is returning nil, and the coordinator
    thinks it isn't actually a store

    See the documentation at

    http://developer.apple.com/documentation/Cocoa/Conceptual/AtomicStore_Conce
    pts/Articles/asLifecycle.html#//apple_ref/doc/uid/TP40004527-SW1


    for what needs to happen when in order to avoid a confused
    coordinator. The key detail is:  "You must also initialize the
    metadata for the store. After
    initWithCoordinator:configurationName:url:options:, the coordinator
    invokes metadata on the new store; at this point the metadata must be
    correct."

    +Melissa

    On Jul 7, 2008, at 13:11, Todd Stanley wrote:

    > Hi All,
    >
    > Has any one had any luck working with the AutomicStoreSubclass
    > example.  I
    > need to manage and AtomicStore and thought that I would be able to
    > use the
    > AutomicStoreSubclass example as a road-map.  When I
    > addPersistentStoreWithType as follows -
    >
    > if ([coordinator addPersistentStoreWithType:@"AtomicStore"
    > configuration:nil URL:url options:storeOptionsDict error:&error])
    >
    > I get the following error -
    >
    > Error Domain=NSCocoaErrorDomain Code=134010 UserInfo=0x162240 "The
    > store
    > type is inconsistent with the data format."
    >
    > Anyone know of any gotchas when subclassing NSAtomicStore?
    >
    > Todd