ios – 如何正确推送JSQMessagesViewController

ios – 如何正确推送JSQMessagesViewController,第1张

概述我有一个 Swift项目,我正在尝试在其中使用JSQMessagesViewController.我使用cocoapods来安装框架,并使用swift import语句导入它. import JSQMessagesViewController 到目前为止,没有错误,一切都在没有警告的情况下编译.但是,当我尝试将新实例推送到导航控制器时,应用程序崩溃了. func openConversation( 我有一个 Swift项目,我正在尝试在其中使用JsQMessagesVIEwController.我使用cocoapods来安装框架,并使用swift import语句导入它.
import JsQMessagesVIEwController

到目前为止,没有错误,一切都在没有警告的情况下编译.但是,当我尝试将新实例推送到导航控制器时,应用程序崩溃了.

func openConversation(userID: Int) {    let messageVIEwController = JsQMessagesVIEwController();    self.navigationController?.pushVIEwController(messageVIEwController,animated: true)}

该方法的第二行导致崩溃和错误消息.

2015-08-03 21:44:17.229 [4856:64097] *** Assertion failure in -[JsQMessagesVIEwController vIEwWillAppear:],/[my file path]/Pods/JsQMessagesVIEwController/JsQMessagesVIEwController/Controllers/JsQMessagesVIEwController.m:2232015-08-03 21:44:17.232 [4856:64097] *** Terminating app due to uncaught exception 'NSInternalinconsistencyException',reason: 'InvalID parameter not satisfying: self.senderID != nil'*** First throw call stack:(    0   CoreFoundation                      0x00000001067e3c65 __exceptionPreprocess + 165    1   libobjc.A.dylib                     0x0000000108590bb7 objc_exception_throw + 45    2   CoreFoundation                      0x00000001067e3aca +[NSException raise:format:arguments:] + 106    3   Foundation                          0x0000000106ec298f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195    4   JsQMessagesVIEwController           0x00000001060e9055 -[JsQMessagesVIEwController vIEwWillAppear:] + 277    5   UIKit                               0x00000001073f8f61 -[UIVIEwController _setVIEwAppearState:isAnimating:] + 487    6   UIKit                               0x000000010741a355 -[UINavigationController _startCustomTransition:] + 887    7   UIKit                               0x000000010742637f -[UINavigationController _startDeferredTransitionIfNeeded:] + 386    8   UIKit                               0x0000000107426ece -[UINavigationController __vIEwWillLayoutSubvIEws] + 43    9   UIKit                               0x00000001075716d5 -[UILayoutContainerVIEw layoutSubvIEws] + 202    10  UIKit                               0x00000001073449eb -[UIVIEw(CALayerDelegate) layoutSublayersOfLayer:] + 536    11  QuartzCore                          0x0000000108f5ded2 -[CALayer layoutSublayers] + 146    12  QuartzCore                          0x0000000108f526e6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380    13  QuartzCore                          0x0000000108f52556 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24    14  QuartzCore                          0x0000000108ebe86e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242    15  QuartzCore                          0x0000000108ebfa22 _ZN2CA11Transaction6commitEv + 462    16  QuartzCore                          0x0000000108ec00d3 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89    17  CoreFoundation                      0x0000000106716ca7 __CFRUNLOOP_IS_CALliNG_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23    18  CoreFoundation                      0x0000000106716c00 __CFRunLoopDoObservers + 368    19  CoreFoundation                      0x000000010670ca33 __CFRunLoopRun + 1123    20  CoreFoundation                      0x000000010670c366 CFRunLoopRunspecific + 470    21  GraphiCSServices                    0x000000010b148a3e GSEventRunModal + 161    22  UIKit                               0x00000001072c48c0 UIApplicationMain + 1282    23  Startana                            0x0000000105fa2807 main + 135    24  libdyld.dylib                       0x0000000109306145 start + 1    25  ???                                 0x0000000000000001 0x0 + 1)libc++abi.dylib: terminating with uncaught exception of type NSException

在线搜索后,我似乎无法找到有关导致此问题的原因的任何信息.

解决方法 我很高兴听到它解决了你的问题!

JsQMessagesVIEwController有两个资产参数,senderID和senderdisplayname.因此,您必须设置senderID和显示名称.

总结

以上是内存溢出为你收集整理的ios – 如何正确推送JSQMessagesViewController全部内容,希望文章能够帮你解决ios – 如何正确推送JSQMessagesViewController所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1094965.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存