{"action":"opened","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/3785","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3785/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3785/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3785/events","html_url":"https://github.com/realm/realm-cocoa/issues/3785","id":161475989,"number":3785,"title":"Unable to open a realm at path after set NSFileProtectionNone","user":{"login":"yreaction","id":518910,"avatar_url":"https://avatars.githubusercontent.com/u/518910?v=3","gravatar_id":"","url":"https://api.github.com/users/yreaction","html_url":"https://github.com/yreaction","followers_url":"https://api.github.com/users/yreaction/followers","following_url":"https://api.github.com/users/yreaction/following{/other_user}","gists_url":"https://api.github.com/users/yreaction/gists{/gist_id}","starred_url":"https://api.github.com/users/yreaction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yreaction/subscriptions","organizations_url":"https://api.github.com/users/yreaction/orgs","repos_url":"https://api.github.com/users/yreaction/repos","events_url":"https://api.github.com/users/yreaction/events{/privacy}","received_events_url":"https://api.github.com/users/yreaction/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-21T16:00:31Z","updated_at":"2016-06-21T16:00:31Z","closed_at":null,"body":"Hi there, I've followed the documentation here for solve our current issue with [background refresh](https://realm.io/docs/swift/latest/#using-realm-with-background-app-refresh), exactly with the same default realm and after the migration block.\r\n\r\n`//Realm Setup\r\n        let realm = try! Realm()\r\n        \r\n        // Get our Realm file's parent directory\r\n        let folderPath = realm.configuration.fileURL!.URLByDeletingLastPathComponent!.path!\r\n        \r\n        // Disable file protection for this directory\r\n        try! NSFileManager.defaultManager().setAttributes([NSFileProtectionKey: NSFileProtectionNone],\r\n                                                          ofItemAtPath: folderPath)`\r\n\r\nBut still we face different errors:\r\n\r\n`fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=2 \"Unable to open a realm at path '/var/mobile/Containers/Data/Application/E5A106ED-CCCC-47B5-B829-FC0F015D205B/Documents/default.realm.lock': open() failed: Operation not permitted.\" UserInfo={Error Code=2, NSFilePath=/var/mobile/Containers/Data/Application/E5A106ED-CCCC-47B5-B829-FC0F015D205B/Documents/default.realm.lock, Underlying=open(\"/var/mobile/Containers/Data/Application/E5A106ED-CCCC-47B5-B829-FC0F015D205B/Documents/default.realm.lock\") failed: Operation not permitted, NSLocalizedDescription=Unable to open a realm at path '/var/mobile/Containers/Data/Application/E5A106ED-CCCC-47B5-B829-FC0F015D205B/Documents/default.realm.lock': open() failed: Operation not permitted.}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-703.0.18.8/src/swift/stdlib/public/core/ErrorType.swift, line 54`\r\n\r\nCan anyone help how to proper set up with the default realm for background fetching.\r\n\r\nThanks in advance"}}
{"actor":{"display_login":"yreaction"}}