ios – 如何识别我的SIGTrap崩溃的原因?

ios – 如何识别我的SIGTrap崩溃的原因?,第1张

概述我的团队最近推出了一个应用程序,其中有很多SIGTRAP崩溃.以前我发现这些相对简单,因为它是在一个有问题的功能中找到一个不良的强制转换或隐式解包的可选设置为nil的问题.这次虽然我找不到那种东西.我最好的猜测是,由于日历错误,可能其中一个TimeBlock对象或其属性为nil. 我们的应用程序是一个会议组织者,它根据FreeTime,Conflicts和Meeting TimeBlocks向用户 我的团队最近推出了一个应用程序,其中有很多SIGTRAP崩溃.以前我发现这些相对简单,因为它是在一个有问题的功能中找到一个不良的强制转换或隐式解包的可选设置为nil的问题.这次虽然我找不到那种东西.我最好的猜测是,由于日历错误,可能其中一个TimeBlock对象或其属性为nil.

我们的应用程序是一个会议组织者,它根据FreeTime,Conflicts和Meeting TimeBlocks向用户显示他们的原生iOS日历事件.我可以访问几个崩溃用户的日历.

Apple SigTrap定义

Swift code will terminate with this exception type if an unexpected
condition is encountered at runtime such as:

a non-optional type with a nil value a Failed forced type conversion

崩溃功能

/**    Updates the conflictHours and meetingHours according to the timeblocks    it is used as quick light reference to the button */func updateTimeHours(timeblocks : [Timeblock]) {    for timeblock in timeblocks {        switch timeblock {        case is MeetingTimeblock:            for i in timeblock.startHour...timeblock.endHour {                self.meetingHours[i] = true            }            break        case is ConflictTimeblock:            for i in timeblock.startHour...timeblock.endHour {                self.conflictsHours[i] = true            }            break        default: break        }    }    updatebuttonByOffset(offset: self.scrollTimeline.contentOffset.x)}

召唤崩溃函数

/**    This function inits the variables and button layout according to the timeblocks */func handleTimeblocksDependantComponents() {    buttonLayout()    guard Scheduler.sharedInstance.timelines.count > SharedGlobals.Calendar.TODAY_INDEX else {        return    }    updateTimeHours(timeblocks : (Scheduler.sharedInstance.timelines[SharedGlobals.Calendar.TODAY_INDEX].timeblocks))}

SetheaderHeight

/** Adjusts the height of the header depending on whether there are hosted meetings or  meeting VIP's or not.*/private func setheaderHeight() {    self.tableVIEw.tableheaderVIEw = self.headerVIEw    let hostedMeetings = OvervIEwInteractor.getHostedMeetings(dayIndex: SharedGlobals.Calendar.SELECTED_DAY)    let vips = OvervIEwInteractor.getVIPS(dayIndex: SharedGlobals.Calendar.SELECTED_DAY)    self.tableVIEw.beginUpdates()    if let headerVIEw = self.tableVIEw.tableheaderVIEw {        var height = 360.0        if(vips.count == 0) { height -= 80.0 }        if(hostedMeetings.count == 0) { height -= 80.0 }        headerVIEw.frame.size.height = CGfloat(height)    }    self.tableVIEw.endUpdates()}

TimeBlock定义

// The Timeblock parent class. It simply holds a start and end time and provIDes its own duration. Not to be used as suchpublic class Timeblock {    public let startTime: Date    public let endTime: Date    /// Returns the hour the Timeblock starts,in current timezone    public var startHour: Int {        get {            return Calendar.current.component(.hour,from: startTime)        }    }    /// Returns the hour the Timeblocks ends,in current timezone    public var endHour: Int {        get {            return Calendar.current.component(.hour,from: endTime)        }    }    /// Returns the minutes the Timeblocks starts    public var startMinutes: Int {        get {            return Calendar.current.component(.minute,from: startTime)        }    }    /// Returns the minutes the Timeblocks ends    public var endMinutes: Int {        get {            return Calendar.current.component(.minute,from: endTime)        }    }    /**        Initialises the instance with a start and end time        - Parameters:            - startTime: The start time of the timeblock            - endTime: The end time of the timeblock    */    public init(startTime: Date,endTime: Date) {        self.startTime = startTime        self.endTime = endTime    }    /**        ProvIDes the Timeblock's duration in the form of a DateInterval        - warning: Only available on iOS 10.0 and up        - returns: A DateInterval of the duration of the Timeblock    */    @available(iOS 10.0,*)    public func getTimeInterval() -> DateInterval {        return DateInterval(start: self.startTime,end: self.endTime)    }    /**        ProvIDes the Timeblock's duration in the form of a `Double` (number of seconds)        - returns: The number of seconds that this Timeblock goes on for    */    public func getDuration() -> Double {        return self.endTime.timeIntervalSince(self.startTime)    }}

崩溃报告

IncIDent IDentifIEr: 98D4F477-C57B-4767-B957-E9EA2E0EE3EA
CrashReporter Key: 0000000000000000000000000000000000000000 HarDWare
Model: undefined Process: xxxxxxx [784] IDentifIEr:
com.xxx.xxx.xx.xxxxxxx Version: 4.0.3 Code Type:
arm64

Date/Time: Sun Dec 24 2017 09:55:23 GMT+0000 (GMT) Launch
Time: InvalID Date OS Version: undefined 11.0.3
(15A432) Report Version: 105

Exception Type: SIGTRAP Exception Subtype: undefined

Thread 0 name: Thread 0 Crashed: 0 Callin
0x0000000102c224e4 specialized
Timelineheader.updateTimeHours(timeblocks:) (Timelineheader.swift:0) 1
Callin 0x0000000102c20af0
Timelineheader.handleTimeblocksDependantComponents()
(Timelineheader.swift:0) 2 Callin
0x0000000102c7a28c specialized
MeetingtableVIEwController.tableVIEw(:vIEwForheaderInSection:)
(Timelineheader.swift:78) 3 Callin
0x0000000102c75d54 @objc
MeetingtableVIEwController.tableVIEw(
:vIEwForheaderInSection:)
(MeetingtableVIEwController.swift:0) 4 UIKit
0x000000018d1157d8 -[UItableVIEw _delegateVIEwForheaderInSection:]
(UIKit) 5 UIKit 0x000000018d11def0
96-[UItableVIEw _sectionheaderVIEw:withFrame:forSection:floating:reuseVIEwIfPossible:willdisplay:]_block_invoke
(UIKit) 6 UIKit 0x000000018cdf1a14
+[UIVIEw(Animation) performWithoutAnimation:] (UIKit) 7 UIKit 0x000000018d11dc60 -[UItableVIEw
_sectionheaderVIEw:withFrame:forSection:floating:reuseVIEwIfPossible:willdisplay:]
(UIKit) 8 UIKit 0x000000018cfc6c04
-[_UItableVIEwUpdateSupport(Private) _setupAnimationsForExistingheadersAndFooters] (UIKit) 9 UIKit 0x000000018cfc1070 -[_UItableVIEwUpdateSupport _setupAnimations]
(UIKit) 10 UIKit 0x000000018cfc0944
-[UItableVIEw _updateWithItems:updateSupport:] (UIKit) 11 UIKit 0x000000018cfa8448 -[UItableVIEw endCellAnimationsWithContext:]
(UIKit) 12 UIKit 0x000000018cfa46e4
-[UItableVIEw endUpdates] (UIKit) 13 Callin 0x0000000102c761a4 MeetingtableVIEwController.setheaderHeight()
(MeetingtableVIEwController.swift:398) 14 Callin
0x0000000102c7a7c8 specialized closure #1 in
MeetingtableVIEwController.refreshtable(
总结

以上是内存溢出为你收集整理的ios – 如何识别我的SIGTrap崩溃的原因?全部内容,希望文章能够帮你解决ios – 如何识别我的SIGTrap崩溃的原因?所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存