So I have no idea why I am getting this error. The error message is as follows:
* Terminating app due to uncaught exception \'RLMException\', reason: \'Attemptin
The beginWriteTransaction
and commitWriteTransaction
have to be called on the same realm the object you're modifying is in. Each time you call [RLMRealm defaultRealm]
, you're getting a new realm. This is not going to be the same realm that's in self.chatSession
. To fix this, first confirm that self.chatSession
's realm is on the same queue as your queueForWrites
(I'm assuming self.chatSession
is a RLMObject
, of course). Then, just do the following inside the block instead:
[self.chatSession.realm beginWriteTransaction];
self.chatSession.myAlias = alertTextField.text;
[self.chatSession.realm commitWriteTransaction];