I'm using LayerKit 0.17.3 with Swift and newConversationWithParticipants always throws an error on first time, with the domain set to FMDatabase and with a "not an error" error. Any subsequent call gets expected result.
Initial error:
Error with creating LYRConversation: Error Domain=FMDatabase Code=0 "not an error"
UserInfo={NSLocalizedDescription=not an error}
Subsequent errors: (desired)
Error with creating LYRConversation: Error Domain=com.layer.LayerKit.Errors
Code=1013 "A conversation with a distinct participant list already exists
for participants [...]
Here's the function to find/create the conversation:
@IBAction func didTapCompose(sender: AnyObject) {
var conversation : LYRConversation?
// create ATLConversationViewController
let controller = ConversationViewController(layerClient: self.layerClient)
controller.hidesBottomBarWhenPushed = true;
// get recipient (user objectID) from member object
let recipient = member.objectForKey(GlobalConstants.Parse.UserKey)?.objectId!
// create set for newConversationWithParticipants
let participants : Set = [recipient!]
do {
try conversation = layerClient.newConversationWithParticipants(participants, options: nil)
controller.conversation = conversation
} catch {
print("Error with creating LYRConversation: \(error)")
}
self.navigationController!.pushViewController(controller, animated: true)
}