Skip to content

Commit 3467187

Browse files
committed
Save CoreData before other files
1 parent 2de2896 commit 3467187

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

MacOSX/Classes/HKPersistentPackageDocument.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ - (BOOL)writeSafelyToURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName fo
176176

177177
if ( success )
178178
{
179-
success = [self updateFileWrapper:filewrapper atPath:[inAbsoluteURL path] error:outError];
180-
[filewrapper writeToFile:filePath atomically:NO updateFilenames:NO];
179+
// Save the Core Data portion of the document.
180+
success = [[self managedObjectContext] save:outError];
181181
}
182182

183183
if ( success )
184184
{
185-
// Save the Core Data portion of the document.
186-
success = [[self managedObjectContext] save:outError];
185+
success = [self updateFileWrapper:filewrapper atPath:[inAbsoluteURL path] error:outError];
186+
[filewrapper writeToFile:filePath atomically:NO updateFilenames:NO];
187187
}
188188

189189
if ( success )

0 commit comments

Comments
 (0)