LayerKit的newConversationWithParticipants总是抛出FMDatabase"而不是错误"在第一次通话

时间:2015-11-28 20:09:45

标签: ios swift fmdb layerkit

我使用带有Swift的LayerKit 0.17.3,并且newConversationWithParticipants总是在第一次引发错误,域名设置为FMDatabase并且"不是错误"错误。任何后续调用都会得到预期的结果。

初始错误:

Error with creating LYRConversation: Error Domain=FMDatabase Code=0 "not an error"
UserInfo={NSLocalizedDescription=not an error}

后续错误:(需要)

Error with creating LYRConversation: Error Domain=com.layer.LayerKit.Errors
Code=1013 "A conversation with a distinct participant list already exists
for participants [...]

这是查找/创建对话的功能:

@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)
}

3 个答案:

答案 0 :(得分:0)

支持在Layer.com上说明这是一个错误,将在下一个版本中修复。

答案 1 :(得分:0)

这仍然被打破,上面的答案说版本是0.17.4,但是cocoapod仍然是0.17.3 https://cocoapods.org/?q=layerkit

我的项目仍在打破

答案 2 :(得分:0)

默认情况下,图层不会创建具有相同参与者的对话。 您必须在创建时在选项中将distinct标志设置为false。

使用layerkit 0.17.4进行测试。

options = [LYRConversationOptionsDistinctByParticipantsKey : false]
let conversation = layerClient.newConversationWithParticipants(participants, options: options)