Howdy all,

Hopefully this is a ridiculously simple question with a ridiculously
simple answer, but I just haven't been able to find it.

I have a document based CoreData app and I want to change the store
type of the file. So it previously saved as XML, and I now want those
docs to save as SQLite. But, i still want to be able to view the XML
based docs, just require the user to re-save as SQLite. There are no
changes to the model. All the data looks and is structured the same.

So I added a new document type with a SQLite store and a different
doctype and set it to editor. I left the old doc available as an
editable document.

At this point, I can open up an XML document, edit it, save it, and
then re-save it as a SQLite document w/o any issues.

The problem is when I flip the XML doc from Editor -> Viewer. I can no
longer save it in place (as expected), but whenever I try to save it
as the SQLite doc, the app crashes. I know that it's bombing somewhere
inside NSPersistentDocument's
writeToURL:ofType:forSaveOperation:originalContentsURL:error:, but
beyond that am lost. In the save document window, the doc type is
correctly set to the new extension for the SQLite store.

Again, when the app is set to editor for XML, I can re-save the doc as
SQLite. When I can only view the XML docs, re-saving as SQLite
crashes.

I've tried all sorts of incantations with PersistentStoreCoordinator's
migratePersistentStore:toURL:options:withType:error:,
addPersistentStoreForURL:, removePersistentStore:error: and have
gotten nowhere. I've also tried explicitly setting the document's
fileType, but have had no luck.

Clearly, this is something that should be easy, since the app handles
it automatically when I can edit the XML docs.

So what do I need to do?

Many thanks in advance,

-Jim....
_______________________________________________

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

Reply via email to