Reputation: 43
I have a class that I need to use in both Core Data and non Core Data applications. In non Core Data applications I need the class to omit certain code at compile time. Are there any compiler directives that detect if Core Data framework is added to the Xcode project, something like #ifdef __COREDATA?
Upvotes: 2
Views: 144
Reputation: 18333
There is a way:
#if NSCoreDataVersionNumber
//my code
#endif //NSCoreDataVersionNumber
And
#ifdef _COREDATADEFINES_H
//my code
#endif
Upvotes: 2
Reputation: 8771
You could just test for a class and see if it's defined.
if ([NSFetchRequest class] == nil)
Upvotes: 0