Permalink
Browse files

Check for iCloud in particular operations

  • Loading branch information...
casademora committed Dec 8, 2011
1 parent db98674 commit 3cf33f47ae6bc3158be2346fa0c22cd013749d60
@@ -32,14 +32,20 @@ + (NSManagedObjectContext *)MR_defaultContext
+ (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
{
NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator];
- [defaultManageObjectContext_ MR_stopObservingiCloudChangesInCoordinator:coordinator];
-
+ if ([MagicalRecordHelpers isICloudEnabled])
+ {
+ [defaultManageObjectContext_ MR_stopObservingiCloudChangesInCoordinator:coordinator];
+ }
+
MR_RETAIN(moc);
MR_RELEASE(defaultManageObjectContext_);
defaultManageObjectContext_ = moc;
- [defaultManageObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator];
+ if ([MagicalRecordHelpers isICloudEnabled])
+ {
+ [defaultManageObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator];
+ }
}
+ (void)MR_resetDefaultContext
@@ -65,9 +65,12 @@ + (NSURL *) MR_urlForStoreName:(NSString *)storeFileName
+ (NSURL *) MR_cloudURLForUbiqutiousContainer:(NSString *)bucketName;
{
NSFileManager *fileManager = [[NSFileManager alloc] init];
+ NSURL *cloudURL = nil;
+ if ([fileManager respondsToSelector:@selector(URLForUbiquityContainerIdentifier:)])
+ {
+ cloudURL = [fileManager URLForUbiquityContainerIdentifier:bucketName];
+ }
MR_AUTORELEASE(fileManager);
- NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:bucketName];
-
return cloudURL;
}
@@ -21,13 +21,13 @@
#endif
#define PRIVATE_QUEUES_ENABLED(...) \
- if (NSCoreDataVersionNumber >= NSCoreDataVersionNumber_iPhoneOS_4_0) \
+ if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_5_0) \
{ \
__VA_ARGS__ \
}
#define THREAD_ISOLATION_ENABLED(...) \
- if (NSCoreDataVersionNumber < NSCoreDataVersionNumber_iPhoneOS_4_0) \
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_5_0) \
{ \
__VA_ARGS__ \
}

0 comments on commit 3cf33f4

Please sign in to comment.