我看到用户遇到此崩溃但是我无法重现我无法从堆栈跟踪中收集任何有用的信息,也看不到代码崩溃的可能性。
Exception Type: SIGTRAP
Exception Codes: #0 at 0x101761e98
Crashed Thread: 0
Thread 0 Crashed:
0 libswiftFoundation.dylib 0x0000000101761e98 0x101734000 + 188056
1 Workyard 0x00000001001a30c4 @objc (extension in Workyard):__ObjC.WBLJobRecipient.isBuyerLastActor.getter : Swift.Bool (WBLJobRecipient+Extensions.swift:42)
2 Workyard 0x00000001001a3188 (extension in Workyard):__ObjC.WBLJobRecipient.lastActionTime.getter : Foundation.Date (WBLJobRecipient+Extensions.swift:46)
3 Workyard 0x00000001001a3148 @objc (extension in Workyard):__ObjC.WBLJobRecipient.lastActionTime.getter : Foundation.Date (WBLJobRecipient+Extensions.swift:0)
4 Workyard 0x0000000100260548 @objc (extension in Workyard):__ObjC.WBLJob.lastActionTimestamp.getter : Foundation.Date (WBLJob+Extensions.swift:16)
5 Foundation 0x000000018952a524 _sortedObjectsUsingDescriptors + 368
6 Foundation 0x0000000189618e50 -[NSSet(NSKeyValueSorting) sortedArrayUsingDescriptors:] + 560
7 Workyard 0x000000010008ef14 -[WBLJobSummaryViewController populateDataWithJobSummary:] (WBLJobSummaryViewController.m:105)
8 Workyard 0x000000010008fb54 -[WBLJobSummaryViewController viewWillAppear:] (WBLJobSummaryViewController.m:261)
9 UIKit 0x000000018e9e2754 -[UIViewController _setViewAppearState:isAnimating:] + 620
10 UIKit 0x000000018e9e24cc -[UIViewController __viewWillAppear:] + 152
其中buyerLastActionTime& sellerLastActionTime是下面定义的日期,lastAction是来自后端的日期,可能是也可能不是
声明
@property (nonatomic, retain) NSDate *buyerLastActionTime;
@property (nonatomic, retain) NSDate *sellerLastActionTime;
勘定
recipient.sellerLastActionTime = lastAction ? lastAction : [NSDate dateWithTimeIntervalSince1970:0];
recipient.buyerLastActionTime = lastAction ? lastAction : [NSDate dateWithTimeIntervalSince1970:0];
来自发生崩溃的类的片段
var isBuyerLastActor: Bool {
:42 return buyerLastActionTime > sellerLastActionTime
}
var lastActionTime: Date {
:46 return (isBuyerLastActor ? buyerLastActionTime : sellerLastActionTime) ?? Date()
}