Commit f1935f07 authored by Tobias's avatar Tobias

fix library copying on device

parent 86072e81
......@@ -324,8 +324,19 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
}
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL success = [fileManager replaceItemAtURL:self.persistentStoreURL
withItemAtURL:replacementURL
NSURL *finalTargetURL = self.persistentStoreURL;
NSString *tmpName = [[NSUUID UUID] UUIDString];
NSURL *tmpTargetURL = [[finalTargetURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:tmpName];
BOOL success = [fileManager copyItemAtURL:replacementURL toURL:tmpTargetURL error:&error];
if (!success) {
NSLog(@"%s failed to copy store to tmp url with with error %@",__PRETTY_FUNCTION__,error);
error = nil;
}
success = [fileManager replaceItemAtURL:self.persistentStoreURL
withItemAtURL:tmpTargetURL
backupItemName:nil
options:0
resultingItemURL:nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment