Improve support for Mac apps, and more specifically, help prevent rejection from the Mac App Store

This commit is contained in:
Saul Mora
2011-06-26 16:41:43 -06:00
parent c9331624b6
commit 05f8952c25

View File

@@ -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