我不在应用程序的 Document 目录中使用 *.realm 文件。我在主捆绑目录中使用它。
当我调用它时:
NSString *path = [[NSBundle mainBundle] pathForResource:@"example" ofType:@"realm"];
RLMRealm *realm = [RLMRealm realmWithPath:path];
它崩溃并记录:
由于未捕获的异常“RLMException”而终止应用程序,原因:“open() failed: Operation not allowed”