mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
Improve support for Mac apps, and more specifically, help prevent rejection from the Mac App Store
This commit is contained in:
@@ -19,20 +19,11 @@ static NSPersistentStore *defaultPersistentStore = nil;
|
||||
+ (void) setDefaultPersistentStore:(NSPersistentStore *) store
|
||||
{
|
||||
defaultPersistentStore = store;
|
||||
|
||||
//#ifdef UIKIT_EXTERN_CLASS
|
||||
// if (store == nil)
|
||||
// {
|
||||
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Core Data Error" message:@"The default NSPersistentStore was set to nil. The most likely cause is the NSManagedObjectModel version has changed. Either create a new data store, or delete the previous store to continue" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
|
||||
// [alert show];
|
||||
// [alert release];
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
|
||||
+ (NSString *) directory:(int) type
|
||||
{
|
||||
return [NSSearchPathForDirectoriesInDomains(type, NSUserDomainMask, YES) lastObject];
|
||||
{
|
||||
return [NSSearchPathForDirectoriesInDomains(type, NSUserDomainMask, YES) lastObject];
|
||||
}
|
||||
|
||||
+ (NSString *)applicationDocumentsDirectory
|
||||
@@ -42,7 +33,18 @@ static NSPersistentStore *defaultPersistentStore = nil;
|
||||
|
||||
+ (NSString *)applicationLibraryDirectory
|
||||
{
|
||||
#ifdef TARGET_OS_MAC
|
||||
|
||||
NSString *applicationName = [[[NSBundle mainBundle] infoDictionary] valueForKey:(NSString *)kCFBundleNameKey];
|
||||
return [[self directory:NSApplicationSupportDirectory] stringByAppendingPathComponent:applicationName];
|
||||
|
||||
#elif defined(TARGET_OS_IPHONE)
|
||||
|
||||
return [self directory:NSLibraryDirectory];
|
||||
|
||||
#else
|
||||
#warning Unsupported OS Target specified
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSURL *) urlForStoreName:(NSString *)storeFileName
|
||||
|
||||
Reference in New Issue
Block a user