Encryption 有没有办法从现有领域数据库中删除加密?
我们正在使用领域的Objective-C版本,版本2.0.2。数据库当前已加密,并且位于字段中 领域启动时出现间歇性崩溃,错误消息为“无法在路径处打开领域…领域文件解密失败”。我们正在使用Realm的最新版本,尚未找到解决方案Encryption 有没有办法从现有领域数据库中删除加密?,encryption,realm,Encryption,Realm,我们正在使用领域的Objective-C版本,版本2.0.2。数据库当前已加密,并且位于字段中 领域启动时出现间歇性崩溃,错误消息为“无法在路径处打开领域…领域文件解密失败”。我们正在使用Realm的最新版本,尚未找到解决方案 我们不需要数据库在设备上加密,所以我们想考虑删除加密。这是一个选项吗?如果是,我们将如何迁移现有的加密数据库?您可以使用writeCopyToURL:encryptionKey:error:和nil加密密钥来写入未加密的副本,然后将其移动到原始文件上: - (BOOL)a
<>我们不需要数据库在设备上加密,所以我们想考虑删除加密。这是一个选项吗?如果是,我们将如何迁移现有的加密数据库?您可以使用
writeCopyToURL:encryptionKey:error:
和nil
加密密钥来写入未加密的副本,然后将其移动到原始文件上:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RLMRealmConfiguration *confg = [[RLMRealmConfiguration alloc] init];
config.encryptionKey = ...;
NSURL *tempUrl = [NSURL URLWithString:[NSTemporaryDirectory() stringByAppendingPathComponent:"temp.realm"]];
// Open the Realm within an autoreleasepool so that it's closed before we try
// to overwrite the original file
@autoreleasepool {
RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
[realm writeCopyToURL:tempUrl encryptionKey:nil error:nil];
}
[[NSFileManager defaultManager] moveItemAtURL:tempUrl toURL:config.fileUrl error:nil];
// ... other didFinishLaunchingWithOptions things ...
return YES;
}
谢谢-这听起来正是我们需要的。如果我们决定走这条路,我会回应它的效果如何。