2

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)
}
Tony
  • 36,591
  • 10
  • 48
  • 83
kokernutz
  • 268
  • 3
  • 9
  • I turned on debugging on layerClient and got this before the "not an error" error: `LYRConversationRepository.m:740 failed to unique with stream for participants:{( qQnH4dQT3T, r1yXUYpXdx )} with Error Domain=FMDatabase Code=0 "not an error" UserInfo={NSLocalizedDescription=not an error}` – kokernutz Nov 28 '15 at 21:44

3 Answers3

0

Support over at Layer.com stated at this is a bug and will be fixed in the next release.

kokernutz
  • 268
  • 3
  • 9
  • 1
    Hi, I'm Abir, Partner Engineer at Layer, and we just pushed v0.17.4 which includes a fix for this. Please run 'pod update' and try it again. If you're still seeing issues email support@layer.com – Abir Majumdar Dec 07 '15 at 23:04
0

This is still broken, the above answer says the version is at 0.17.4, but cocoapod is still at 0.17.3 https://cocoapods.org/?q=layerkit

It is still breaking on my project

Ray Wang
  • 23
  • 6
  • They updated the cocoapod but it's still broken. I am still unable to create conversations. Oh god I wish I picked QuickBlox...but I already put too much work learning layer... – Ray Wang Dec 09 '15 at 00:38
0

Layer does not create conversations with same participants by default. You have to set the distinct flag to false in options while creating.

Tested with layerkit 0.17.4.

options = [LYRConversationOptionsDistinctByParticipantsKey : false]
let conversation = layerClient.newConversationWithParticipants(participants, options: options)
Deepthi Chand
  • 21
  • 1
  • 5