tryGetOrCreateMe do not in outer beginWriteTransaction commitWriteTransaction

This commit is contained in:
nixzhu
2015-03-27 13:26:58 +08:00
parent 7fe24747ba
commit ca4235caa7
+7 -6
View File
@@ -514,17 +514,18 @@ func sendText(text: String, toRecipient recipientID: String, #recipientType: Str
message.mediaType = MessageMediaType.Text.rawValue
message.textContent = text
//
if let me = tryGetOrCreateMe() {
message.fromFriend = me
}
realm.addObject(message)
realm.commitWriteTransaction()
//
if let me = tryGetOrCreateMe() {
realm.beginWriteTransaction()
message.fromFriend = me
realm.commitWriteTransaction()
}
// Conversation