Fix crash under iOS 5.0.x due to attempt to use unavailable NSURLIsExcludedFromBackupKey symbol. fixes #1015

This commit is contained in:
Blake Watters
2012-10-29 10:47:13 -04:00
parent ea8666e2ec
commit 7fba450311
3 changed files with 54 additions and 12 deletions

View File

@@ -147,18 +147,8 @@ static RKManagedObjectStore *defaultStore = nil;
persistentStore = [self.persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nilOrConfigurationName URL:storeURL options:seedOptions error:error];
if (! persistentStore) return nil;
/**
Exclude the SQLite database from iCloud Backups to conform to the iCloud Data Storage Guidelines
See https://developer.apple.com/icloud/documentation/data-storage/
*/
#if __IPHONE_OS_VERSION_MIN_REQUIRED
BOOL success = [storeURL setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:error];
if (!success) {
RKLogError(@"Failed to exclude SQLite store at path '%@' from iCloud Backup: %@", storePath, *error);
return nil;
}
#endif
// Exclude the SQLite database from iCloud Backups to conform to the iCloud Data Storage Guidelines
RKSetExcludeFromBackupAttributeForItemAtPath(storePath);
return persistentStore;
}