我正在初始化我的领域实例,如下所示:
private static let sUserRealm:Realm = try! Realm(configuration:Realm.Configuration(
fileURL: Bundle.main.url(forResource: "user" ,withExtension: "realm"),
inMemoryIdentifier: nil,
syncConfiguration: nil,
encryptionKey: nil,
readOnly: false,
schemaVersion: 0,
migrationBlock: sMigrationBlock,
deleteRealmIfMigrationNeeded: true,
objectTypes: nil))
但是,我收到了这个错误:
fatal error: A Realm Configuration must specify a path or an in-memory
identifier.: file /Users/realm/workspace/Package iOS Swift/tightdb_objc/RealmSwift/RealmConfiguration.swift, line 201
所有领域在其关于创建多个领域的快速文档中都有这个示例,即使逐字复制也会引发相同的错误。如何创建和访问领域文件?