You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a realm database, and I can fetch the data on my iOS application class on the mobile device. but I need to fetch data from the custom keyboard extension class of the same application. I got a realm. lock file operation not permitted error is thrown as
Error Domain=io.realm Code=3 "Failed to open file at path '/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock': Operation not permitted" UserInfo={Error Code=3, NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock, Error Name=PermissionDenied, NSLocalizedDescription=Failed to open file at path '/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock': Operation not permitted.
I tried the input source:
`let strpath = userDefaultAddress?.value(forKey: "shared_bigram_file_path")
let realmURL = URL(fileURLWithPath: strpath as! String )
let config = Realm.Configuration(fileURL: realmURL)
let realm = try! Realm()
// Get our Realm file's parent directory
let folderPath = realm.configuration.fileURL!.deletingLastPathComponent().path
// Disable file protection for this directory
try! FileManager.default.setAttributes([FileAttributeKey(rawValue: FileAttributeKey.protectionKey.rawValue): FileProtectionType.none], ofItemAtPath: folderPath)
do {
let realm = try Realm(configuration: config)
let results = realm.objects(IndianSpace.self)
} catch {
print("Error opening Realm: (error)")
}`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have created a realm database, and I can fetch the data on my iOS application class on the mobile device. but I need to fetch data from the custom keyboard extension class of the same application. I got a realm. lock file operation not permitted error is thrown as
Error Domain=io.realm Code=3 "Failed to open file at path '/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock': Operation not permitted" UserInfo={Error Code=3, NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock, Error Name=PermissionDenied, NSLocalizedDescription=Failed to open file at path '/private/var/mobile/Containers/Shared/AppGroup/23DD1FD4-A291-4599-9D5F-84057FE6CF26/BigramFileShared.realm.lock': Operation not permitted.
I tried the input source:
`let strpath = userDefaultAddress?.value(forKey: "shared_bigram_file_path")
let realmURL = URL(fileURLWithPath: strpath as! String )
let config = Realm.Configuration(fileURL: realmURL)
let realm = try! Realm()
// Get our Realm file's parent directory
let folderPath = realm.configuration.fileURL!.deletingLastPathComponent().path
// Disable file protection for this directory
try! FileManager.default.setAttributes([FileAttributeKey(rawValue: FileAttributeKey.protectionKey.rawValue): FileProtectionType.none], ofItemAtPath: folderPath)
do {
let realm = try Realm(configuration: config)
let results = realm.objects(IndianSpace.self)
} catch {
print("Error opening Realm: (error)")
}`
Beta Was this translation helpful? Give feedback.
All reactions