首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >基于pushViewController的CollectionView生成SIGABRT

基于pushViewController的CollectionView生成SIGABRT
EN

Stack Overflow用户
提问于 2017-09-26 09:03:20
回答 1查看 200关注 0票数 0

下面的函数调用生成线程1: EXC_BREAKPOINT (code=1,subcode=0x189d35a80)。

代码语言:javascript
复制
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委托中,我得到了arraycount >0,但它没有在numberOfItems之后调用collectionView: cellForItemAt,并使用SIGABRT崩溃,然后是上面的崩溃。有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-09-27 01:23:45

愚蠢的错误。我多次调用showChatView:原因是我只为ChatViewController创建了一个对象,但是我忘了检查pushViewController。这就是崩溃的原因。谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46416298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档