2

我将 LayerKit 0.17.3 与 Swift 一起使用,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)
}
4

3 回答 3

0

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

我的项目仍在中断

于 2015-12-08T03:56:07.997 回答
0

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

使用 layerkit 0.17.4 测试。

options = [LYRConversationOptionsDistinctByParticipantsKey : false]
let conversation = layerClient.newConversationWithParticipants(participants, options: options)
于 2015-12-11T11:09:07.297 回答
0

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

于 2015-12-01T00:22:47.913 回答