Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 崩溃[UITableViewCell initWithStyle:reuseIdentifier:]_Ios_Swift_Uitableview_Uiview_Calayer - Fatal编程技术网

Ios 崩溃[UITableViewCell initWithStyle:reuseIdentifier:]

Ios 崩溃[UITableViewCell initWithStyle:reuseIdentifier:],ios,swift,uitableview,uiview,calayer,Ios,Swift,Uitableview,Uiview,Calayer,我有SIGSEGV的坠机报告。我认为这并不明显,因为有: 没有后台UI操作 没有外部CALayer操作 UITableViewCell以编程方式初始化,无需使用xib或故事板 没有KVO在单元属性上执行 它只发生过一次,因此没有复制的步骤 事故日志如下: 0 libobjc.A.dylib 0x0000000181d6dbd0 objc_msgSend + 16 1 Foundation 0x0

我有SIGSEGV的坠机报告。我认为这并不明显,因为有:

  • 没有后台UI操作
  • 没有外部CALayer操作
  • UITableViewCell以编程方式初始化,无需使用xib或故事板
  • 没有KVO在单元属性上执行
  • 它只发生过一次,因此没有复制的步骤

    事故日志如下:

    0   libobjc.A.dylib                      0x0000000181d6dbd0 objc_msgSend + 16
    1   Foundation                           0x0000000182fc28e4 -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 320
    2   QuartzCore                           0x0000000184ddf374 CA::Layer::set_delegate(objc_object*) + 68
    3   UIKit                                0x00000001873e2538 -[UIView _createLayerWithFrame:] + 576
    4   UIKit                                0x00000001873e1ff8 UIViewCommonInitWithFrame + 684
    5   UIKit                                0x00000001873e1ce8 -[UIView initWithFrame:] + 136
    6   UIKit                                0x00000001874c0ee8 -[UITableViewCell initWithStyle:reuseIdentifier:] + 108
    7   MyApp                              0x000000010017d208 MyApp.MessageCell.init (MyApp.MessageCell.Type)(style : __C.UITableViewCellStyle, reuseIdentifier : Swift.String?) -> MyApp.MessageCell (MessageCell.swift:23)
    8   MyApp                              0x000000010017d340 @objc MyApp.MessageCell.init (MyApp.MessageCell.Type)(style : __C.UITableViewCellStyle, reuseIdentifier : Swift.String?) -> MyApp.MessageCell (MessageCell.swift:0)
    9   UIKit                                0x000000018752bbe0 -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 524
    10  UIKit                                0x0000000187567bd4 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 84
    11  MyApp                              0x000000010016d60c MyApp.ChatDataSource.dequeueMessageCell (MyApp.ChatDataSource)(MyApp.Message, tableView : __ObjC.UITableView, indexPath : __ObjC.NSIndexPath) -> __ObjC.UITableViewCell (ChatDataSource.swift:76)
    12  MyApp                              0x000000010016cf48 MyApp.ChatDataSource.cellAtIndexPath (MyApp.ChatDataSource)(__ObjC.NSIndexPath!, inTableView : __ObjC.UITableView!) -> __ObjC.UITableViewCell! (ChatDataSource.swift:55)
    13  MyApp                              0x000000010016d324 @objc MyApp.ChatDataSource.cellAtIndexPath (MyApp.ChatDataSource)(__ObjC.NSIndexPath!, inTableView : __ObjC.UITableView!) -> __ObjC.UITableViewCell! (ChatDataSource.swift:0)
    14  MyApp                              0x000000010005cb34 -[SFPaginationDataSource tableView:cellForRowAtIndexPath:] (SFPaginationDataSource.m:202)
    15  UIKit                                0x000000018773131c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 688
    16  UIKit                                0x0000000187731484 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 76
    17  UIKit                                0x00000001877207e8 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2356
    18  UIKit                                0x0000000187735fb0 -[UITableView _performWithCachedTraitCollection:] + 100
    19  UIKit                                0x00000001874cb08c -[UITableView layoutSubviews] + 172
    20  UIKit                                0x00000001873db778 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 652
    21  QuartzCore                           0x0000000184deab2c -[CALayer layoutSublayers] + 144
    22  QuartzCore                           0x0000000184de5738 CA::Layer::layout_if_needed(CA::Transaction*) + 288
    23  UIKit                                0x00000001873f2454 -[UIView(Hierarchy) layoutBelowIfNeeded] + 920
    24  TextViewController              0x0000000100ec03f4 0x100ea8000 + 99316
    25  MyApp                              0x00000001001f5680 MyApp.ChatViewControler.viewWillAppear (MyApp.ChatViewControler)(Swift.Bool) -> () (ChatViewControler.swift:52)
    26  MyApp                              0x00000001001f59a4 @objc MyApp.ChatViewControler.viewWillAppear (MyApp.ChatViewControler)(Swift.Bool) -> () (ChatViewControler.swift:0)
    27  UIKit                                0x00000001873f874c -[UIViewController _setViewAppearState:isAnimating:] + 624
    28  UIKit                                0x00000001873f84c0 -[UIViewController __viewWillAppear:] + 152
    29  UIKit                                0x0000000187591ce4 -[UINavigationController _startCustomTransition:] + 1048
    30  UIKit                                0x000000018749e9b8 -[UINavigationController _startDeferredTransitionIfNeeded:] + 684
    31  UIKit                                0x000000018749e694 -[UINavigationController __viewWillLayoutSubviews] + 56
    32  UIKit                                0x000000018749e5fc -[UILayoutContainerView layoutSubviews] + 204
    33  UIKit                                0x00000001873db778 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 652
    34  QuartzCore                           0x0000000184deab2c -[CALayer layoutSublayers] + 144
    35  QuartzCore                           0x0000000184de5738 CA::Layer::layout_if_needed(CA::Transaction*) + 288
    36  QuartzCore                           0x0000000184de55f8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
    37  QuartzCore                           0x0000000184de4c94 CA::Context::commit_transaction(CA::Transaction*) + 248
    38  QuartzCore                           0x0000000184de49dc CA::Transaction::commit() + 508
    39  UIKit                                0x00000001873d1c78 _afterCACommitHandler + 176
    40  CoreFoundation                       0x00000001826a4588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
    41  CoreFoundation                       0x00000001826a232c __CFRunLoopDoObservers + 368
    42  CoreFoundation                       0x00000001826a275c __CFRunLoopRun + 924
    43  CoreFoundation                       0x00000001825d1680 CFRunLoopRunSpecific + 380
    44  GraphicsServices                     0x0000000183ae0088 GSEventRunModal + 176
    45  UIKit                                0x0000000187448d90 UIApplicationMain + 200
    46  MyApp                              0x0000000100199718 main (AppDelegate.swift:17)
    47  ???                                  0x00000001821728b8 0x0 + 0
    
    MessageCell.swift

    import UIKit
    
    class MessageCell: UITableViewCell, ConfigurableCell {
    
        var messageView = MessageView()
    
        var alignment: MessageLayout.MessageAligmment {
            get { return messageView.layout.mode }
            set {
                messageView.layout.mode = newValue
            }
        }
    
        override required init(style: UITableViewCellStyle, reuseIdentifier: String?) {
            super.init(style: style, reuseIdentifier: reuseIdentifier)
            defaultInit()
        }
    
        required init?(coder aDecoder: NSCoder) {
            super.init(coder: aDecoder)
            defaultInit()
        }
    
        func defaultInit() {
            selectionStyle = .None
            contentView.addSubview(messageView)
            messageView.autoPinEdgesToSuperviewEdges()
        }
    
        func configure(item: Message) {
            messageView.configure(item)
        }
    }
    
    “认为它不是无效的KVO观察器(因为它发生在对象初始化期间)的结论是不正确的。出于历史原因,KVO使用边表将对象地址与观察者关联起来。这意味着,如果原始的观察对象被解除分配,那么占据相同地址的下一个对象实际上就是新的观察对象。KVO将充当正在观察新对象的角色,并将尝试向可能也已解除分配的观察者发出更改通知。” 从

    “因为它发生在对象初始化期间,所以它不是无效的KVO观察器的结论是不正确的。出于历史原因,KVO使用边表将对象地址与观察者关联起来。这意味着,如果原始的观察对象被解除分配,那么占据相同地址的下一个对象实际上就是新的观察对象。KVO将充当正在观察新对象的角色,并将尝试向可能也已解除分配的观察者发出更改通知。”

    没有任何代码,我们就没有机会进行诊断。MessageCell的第23行是什么。swift?没有,问题。我可以提供代码,但它非常简单,如果它只发生过一次,并且你无法复制,这是对发生了什么的推测。我想这与你的签名有关NadaSourceLouis,嗯,在SFPaginationDataSource cellForRow中没有额外的工作…-它是一种围绕出列和配置单元格的架构包装。我已经使用它一年多了,但是我第一次面临崩溃。你解决过这个问题吗?我也遇到了类似的崩溃,代码非常简单。我们没有任何代码无法诊断。MessageCell的第23行是什么?斯威夫特?不,问题。我可以提供代码,但如果它只发生过一次,而且你无法复制,这是一种推测。我想这与你的SFPaginationDatasource有关路易斯,嗯,没有SFPaginationDataSource cellForRow中的额外工作…-它是一种围绕出列和配置单元格的架构包装器。我已经使用它一年多了,但是我第一次遇到的崩溃你解决过这个问题吗?我也遇到了类似的崩溃,代码也很简单。