当视图控制器中包含自定义视图时,应用程序冻结

时间:2018-10-03 03:23:21

标签: ios uiview

当我将ProfileHeaderView作为子视图添加到MDCFlexibleHeaderViewController时,出现以下错误:

Thread 1: EXC_BAD_ACCESS (code=2, address=0x991fd4)

调用以下方法时引发错误:

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    self.commonInit()
}

调用super.init()方法时将调用错误。我在控制台中看不到其他错误消息。关于如何解决它的任何想法?

仅供参考,ProfileHeaderView类的代码如下:

class ProfileHeaderView: UIView {

@IBOutlet var header: ProfileHeaderView!

override init(frame: CGRect) {
    super.init(frame:frame)
    commonInit()
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    self.commonInit()
}

private func commonInit(){
    Bundle.main.loadNibNamed("ProfileHeaderView", owner: self, options: nil)
    addSubview(header)
    header.frame = self.bounds
    header.autoresizingMask = [.flexibleHeight,.flexibleWidth]
}

/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
    // Drawing code
}
*/

}

我不继承MDCFlexibleHeaderViewController的子类。

错误日志

2018-10-02 22:19:14.179637-0500 builditbigger[564:444592] 5.4.1 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. 

Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2018-10-02 22:19:14.179752-0500 builditbigger[564:444592] 5.4.1 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.50001000 started
2018-10-02 22:19:14.184430-0500 builditbigger[564:444592] 5.4.1 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see url)

0 个答案:

没有答案