views:

55

answers:

1

NSXMLTypeStore is used when starting Core Data backed application by default because it's good for debugging purposes. But practice dictates that developer should use either NSBinaryStoreType, NSInMemoryStoreType or NSSQLiteStoreType store types in release builds.

How do you manage changes between debug and release builds? I believe that changing store type from NSXMLTypeStore to, say, NSBinaryStoreType in code on each release is kinda cumbersome.

+2  A: 

You can use a conditional #define statement in your header file:

#if DEBUG
#define NSMyTypeStore  NSXMLTypeStore
#else
#define NSMyTypeStore  NSBinaryStoreType
#endif

And then in your code, use the NSMyBackingStore definition where you need a NSStoreType.

Laurent Etiemble