Reputation: 1334
Whenever I try to read or write from the Realm within an XCTest, I'm getting this permission denied error: "RLMException", "open() failed: Permission denied"
.
Even after making sure that the default Realm is set to a different path (RLMRealm.setDefaultRealmPath("TestRealm")
) before any test is run, the problem still persists.
I'd like to avoid losing simplicity by passing through a Realm with every model function to accommodate testing them. The docs state it's possible, but I can't seem to get it working.
Upvotes: 0
Views: 761
Reputation: 14409
RLMRealm.setDefaultRealmPath(_:)
is expecting an absolute path to the Realm file, so "TestRealm" is not a suitable path. Changing that to a path that the process has write access to should fix your issue.
Upvotes: 1