I'm trying to cross every 't' and dot every 'i' for my atomic store subclass as I try to find the source of my "save as" problems, and in doing so, I have implemented the identifier and setIdentifier methods I mentioned below (even though the documentation seems to imply that there are default implementations that are good enough for my purposes).
In doing so, I put breakpoints on the methods and found that the -identifier method was being called but never setIdentifier, and when saving it crashes. In the example CustomAtomicStoreSubclass, it overrides identifier and setIdentifier, but never sets any values itself, so I am assuming that if it was put in a project and used as is, that it would crash too. Hence, I come back to my questions from last week as below, and more specifically with regard to the first one, if I do override the implementation of identifier and setIdentifier, should I just set the value to a UUID in the init method, or something else? In my experimentation so far, it seems to make no difference to where I get up to when my program crashes, either implementing identifier and setIdentifier with a UUID, or not implementing those methods at all. Any guidance would be appreciated on these questions. Regards Gideon On 10/03/2010, at 11:41 PM, Gideon King wrote: > In the documentation, it says that I have to override: > > type > identifier > setIdentifier > metadata > metadataForPersistentStoreWithURL:error: > setMetadata:forPersistentStoreWithURL:error: > > from NSPersistentStore in addition to the overrides for NSAtomicStore, but > the CustomAtomicStoreSubclass example doesn't implement the metadata method > at all, and the documentation says that the NSPersistentStore provides a > default implementation of identifier. > > So I have some questions: > > 1. Do I actually need to override identifier and setIdentifier in my > subclass, or is it OK for me to just rely on the default implementation I > inherit from NSPersistentStore? From the documentation, it sounds as if the > default implementation would be sufficient. > > 2. Do I actually need to override the metadata method, given the fact that > the example code doesn't? It appears to be able to call the superclass > methods OK, and the documentation of NSAtomicStore says that it implements a > default dictionary of metadata, and I just have to ensure that it is saved. > Sounds as if the default implementation should be sufficient. > > 3. It appears that I have to write the metadata out to file with the rest of > the data for the application. Our application is cross platform, and it is > possible that the file may be read and altered on the Windows version. If it > was written back again without the metadata, what would the impact of that > be? Actually there would be other cases where third party utilities could > create one of our files, and they would not know what to write into the > metadata. Could I just ask the atomic store for its metadata without using > setMetadata, and get back a value that I could use (and subsequently store)? > > Thanks > > Gideon > > > > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com