0
下面的函數調用生成線程1:EXC_BREAKPOINT(code = 1,subcode = 0x189d35a80)。CollectionView在pushViewController上生成SIGABRT
func showChatView(message: ChatMessage) {
DispatchQueue.main.async {
if self.chatViewController == nil {
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
self.chatViewController = mainStoryboard.instantiateViewController(withIdentifier: "VAChatViewController") as? VAChatViewController
self.chatViewController?.delegate = self;
}
self.chatViewController?.messages += [message]
self.navigationController?.pushViewController(self.chatViewController!, animated: true, completion: {
let buttonMessage = self.chatViewController?.messages.last
let hasButtons = buttonMessage?.hasButtons
if hasButtons! {
let vaButtonModel = ChatMessage(buttons: buttonMessage?.buttons)
self.chatViewController?.addNewMessage(vaButtonModel)
}
})
}
}
還有一東西─VAChatViewController實現的CollectionView顯示聊天呼入事件,這是一個字符串信息「XYZ」的響應。在collectionView委託中,我得到數組[count]> 0,但它沒有在numberOfItems之後調用collectionView:cellForItemAt,並在SIGABRT之後崩潰。任何想法?
發佈您的'UICollectionViewDelegate'和'UICollectionViewDataSource'方法的代碼。 – Glenn
只有數據源被執行! numberOfItemsInSection和cellForItemAt:函數的CollectionView(_的CollectionView:UICollectionView,numberOfItemsInSection部的:int) - >內部{ 返回messages.count }讓消息= self.messages [indexPath.item] 開關message.messageType { 情況.chatContent: let cell = collectionView.dequeueReusableCell(withReuseIdentifier:「ChatCollectionCell」,for:indexPath)as! ChatCollectionViewCell cell.setupWithMessage(message) return cell – Tarun