我在应用程序中的特定行上发生间歇性崩溃。我无法重新创建这个问题。在所有测试中,使用两个不同的iPad以及所有无法使其崩溃的模拟器,但是我在上个月造成了36次用户崩溃。
以下是相关代码和Crashlytics的崩溃报告。
该线总是显示为崩溃;
cell.textLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Purchase Full Version Now (%@)",nil), self.sellPrice];
希望有人可以提供帮助,我感谢任何建议。
(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
UILabel *titleCellLabel = [[UILabel alloc] init];
if (indexPath.section == 0){
switch (indexPath.row) {
case 0:
cell.textLabel.text = NSLocalizedString(@"Default Type",nil);
break;
case 1:
cell.textLabel.text = NSLocalizedString(@"Default Attendee",nil);
break;
case 2:
cell.textLabel.text = NSLocalizedString(@"PDF Set-up",nil);
break;
case 3:
titleCellLabel.text = NSLocalizedString(@"Topic and Item Numbering",nil);
titleCellLabel.font = [UIFont systemFontOfSize:17 weight:UIFontWeightBold];
titleCellLabel.textColor = [UIColor blackColor];
[titleCellLabel sizeToFit];
titleCellLabel.frame = CGRectMake(20, 12, titleCellLabel.frame.size.width, titleCellLabel.frame.size.height);
[[cell contentView] addSubview:titleCellLabel];
break;
default:
break;
}
}
if (indexPath.section == 1){
switch (indexPath.row) {
case 0:
cell.textLabel.text = NSLocalizedString(@"Version",nil);
break;
case 1:
cell.textLabel.text = NSLocalizedString(@"Feedback",nil);
break;
case 2:
cell.textLabel.text = NSLocalizedString(@"Help",nil);
break;
default:
break;
}
}
if (indexPath.section == 2){
switch (indexPath.row) {
case 0:
cell.textLabel.text = NSLocalizedString(@"Backup Data to Email",nil);
break;
case 1:
cell.textLabel.text = NSLocalizedString(@"Restore Previous Full Version Purchase",nil);
break;
case 2:
cell.textLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Purchase Full Version Now (%@)",nil), self.sellPrice];
break;
default:
break;
}
}
}
这是崩溃报告;
# Crashlytics - plaintext stacktrace downloaded by Paul at Tue, 06 Feb 2018 01:22:20 GMT
# Platform: ios
# OS Version: 10.3.3 (14G60)
# Device: iPad 4
# RAM Free: 7.1%
# Disk Free: 13.2%
#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1aeb1f4c fixupMethodList(method_list_t*, bool, bool) + 103
1 libobjc.A.dylib 0x1aea4d01 NXMapInsert + 62
2 libobjc.A.dylib 0x1aeb19e9 prepareMethodLists(objc_class*, method_list_t**, int, bool, bool) + 88
3 libobjc.A.dylib 0x1aeab2d3 realizeClass(objc_class*) + 918
4 libobjc.A.dylib 0x1aeaebc7 lookUpImpOrForward + 94
5 libobjc.A.dylib 0x1aeaeb65 _class_lookupMethodAndLoadCache3 + 26
6 libobjc.A.dylib 0x1aeb51af _objc_msgSend_uncached + 14
7 Simple Meeting Minutes 0x96697 -[MMSettingsTableVC tableView:willDisplayCell:forRowAtIndexPath:] (MMSettingsTableVC.m:195)
8 UIKit 0x21179ca9 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 814
9 UIKit 0x21179de5 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 66
10 UIKit 0x21167d79 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2190
11 UIKit 0x2117e8db -[UITableView _performWithCachedTraitCollection:] + 92
12 UIKit 0x20f2af0f -[UITableView layoutSubviews] + 178
13 UIKit 0x20e49483 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1224
14 QuartzCore 0x1eaa1cb7 -[CALayer layoutSublayers] + 126
15 QuartzCore 0x1ea95d77 CA::Layer::layout_if_needed(CA::Transaction*) + 354
16 QuartzCore 0x1ea95c05 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
17 QuartzCore 0x1ea24839 CA::Context::commit_transaction(CA::Transaction*) + 320
18 QuartzCore 0x1ea42fdb CA::Transaction::commit() + 578
19 UIKit 0x20e3f93b _afterCACommitHandler + 238
20 CoreFoundation 0x1bbdb803 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
21 CoreFoundation 0x1bbd9a55 __CFRunLoopDoObservers + 282
22 CoreFoundation 0x1bbda017 __CFRunLoopRun + 1358
23 CoreFoundation 0x1bb2d1af CFRunLoopRunSpecific + 470
24 CoreFoundation 0x1bb2cfd1 CFRunLoopRunInMode + 104
25 GraphicsServices 0x1d2d7b41 GSEventRunModal + 80
26 UIKit 0x20eafa53 UIApplicationMain + 150
27 App Name 0x63123 main (main.m:16)
28 libdyld.dylib 0x1b31a4eb start + 2
#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1aeb1f4c fixupMethodList(method_list_t*, bool, bool) + 103
1 libobjc.A.dylib 0x1aea4d01 NXMapInsert + 62
2 libobjc.A.dylib 0x1aeb19e9 prepareMethodLists(objc_class*, method_list_t**, int, bool, bool) + 88
3 libobjc.A.dylib 0x1aeab2d3 realizeClass(objc_class*) + 918
4 libobjc.A.dylib 0x1aeaebc7 lookUpImpOrForward + 94
5 libobjc.A.dylib 0x1aeaeb65 _class_lookupMethodAndLoadCache3 + 26
6 libobjc.A.dylib 0x1aeb51af _objc_msgSend_uncached + 14
7 App Name 0x96697 -[MMSettingsTableVC tableView:willDisplayCell:forRowAtIndexPath:] (MMSettingsTableVC.m:195)
8 UIKit 0x21179ca9 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 814
9 UIKit 0x21179de5 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 66
10 UIKit 0x21167d79 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2190
11 UIKit 0x2117e8db -[UITableView _performWithCachedTraitCollection:] + 92
12 UIKit 0x20f2af0f -[UITableView layoutSubviews] + 178
13 UIKit 0x20e49483 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1224
14 QuartzCore 0x1eaa1cb7 -[CALayer layoutSublayers] + 126
15 QuartzCore 0x1ea95d77 CA::Layer::layout_if_needed(CA::Transaction*) + 354
16 QuartzCore 0x1ea95c05 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
17 QuartzCore 0x1ea24839 CA::Context::commit_transaction(CA::Transaction*) + 320
18 QuartzCore 0x1ea42fdb CA::Transaction::commit() + 578
19 UIKit 0x20e3f93b _afterCACommitHandler + 238
20 CoreFoundation 0x1bbdb803 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
21 CoreFoundation 0x1bbd9a55 __CFRunLoopDoObservers + 282
22 CoreFoundation 0x1bbda017 __CFRunLoopRun + 1358
23 CoreFoundation 0x1bb2d1af CFRunLoopRunSpecific + 470
24 CoreFoundation 0x1bb2cfd1 CFRunLoopRunInMode + 104
25 GraphicsServices 0x1d2d7b41 GSEventRunModal + 80
26 UIKit 0x20eafa53 UIApplicationMain + 150
27 App Name 0x63123 main (main.m:16)
28 libdyld.dylib 0x1b31a4eb start + 2
#1. Thread
0 libsystem_kernel.dylib 0x1b3ee73c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b4a2745 _pthread_wqthread + 728
2 libsystem_pthread.dylib 0x1b4a245c start_wqthread + 8
#2. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1b3d8900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b3d86e1 mach_msg + 44
2 CoreFoundation 0x1bbdbbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1bbda065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1bb2d1af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1bb2cfd1 CFRunLoopRunInMode + 104
6 Foundation 0x1c481af5 <redacted> + 258
7 Foundation 0x1c49e76d <redacted> + 86
8 UIKit 0x217b0ad9 -[UIEventFetcher threadMain] + 128
9 Foundation 0x1c5658eb <redacted> + 1122
10 libsystem_pthread.dylib 0x1b4a493b _pthread_body + 216
11 libsystem_pthread.dylib 0x1b4a485d _pthread_start + 234
12 libsystem_pthread.dylib 0x1b4a2468 thread_start + 8
#3. com.twitter.crashlytics.ios.MachExceptionServer
0 App Name 0xbb343 CLSProcessRecordAllThreads + 1057603
1 App Name 0xbb343 CLSProcessRecordAllThreads + 1057603
2 App Name 0xbb23b CLSProcessRecordAllThreads + 1057339
3 App Name 0xaf18d CLSHandler + 1008013
4 App Name 0xaaed7 CLSMachExceptionServer + 990935
5 libsystem_pthread.dylib 0x1b4a493b _pthread_body + 216
6 libsystem_pthread.dylib 0x1b4a485d _pthread_start + 234
7 libsystem_pthread.dylib 0x1b4a2468 thread_start + 8
#4. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1b3d8900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b3d86e1 mach_msg + 44
2 CoreFoundation 0x1bbdbbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1bbda065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1bb2d1af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1bb2cfd1 CFRunLoopRunInMode + 104
6 CFNetwork 0x1c20a393 +[NSURLConnection(Loader) _resourceLoadLoop:] + 402
7 Foundation 0x1c5658eb <redacted> + 1122
8 libsystem_pthread.dylib 0x1b4a493b _pthread_body + 216
9 libsystem_pthread.dylib 0x1b4a485d _pthread_start + 234
10 libsystem_pthread.dylib 0x1b4a2468 thread_start + 8
#5. Thread
0 libsystem_kernel.dylib 0x1b3ed808 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x1b4a3c43 _pthread_cond_wait + 560
2 libsystem_pthread.dylib 0x1b4a4fc5 pthread_cond_wait + 38
3 libc++.1.dylib 0x1ae3fc57 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 118
4 JavaScriptCore 0x1fa94261 <redacted> + 88
5 JavaScriptCore 0x1fa941e5 <redacted> + 154
6 JavaScriptCore 0x1fa940ed <redacted> + 18
7 JavaScriptCore 0x1fa9432f <redacted> + 66
8 libsystem_pthread.dylib 0x1b4a493b _pthread_body + 216
9 libsystem_pthread.dylib 0x1b4a485d _pthread_start + 234
10 libsystem_pthread.dylib 0x1b4a2468 thread_start + 8
#6. WebThread
0 libsystem_kernel.dylib 0x1b3d8900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b3d86e1 mach_msg + 44
2 CoreFoundation 0x1bbdbbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1bbda065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1bb2d1af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1bb2cfd1 CFRunLoopRunInMode + 104
6 WebCore 0x1fd4bce3 <redacted> + 426
7 libsystem_pthread.dylib 0x1b4a493b _pthread_body + 216
8 libsystem_pthread.dylib 0x1b4a485d _pthread_start + 234
9 libsystem_pthread.dylib 0x1b4a2468 thread_start + 8
#7. Thread
0 libsystem_kernel.dylib 0x1b3ee73c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b4a28eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1b4a245c start_wqthread + 8
#8. Thread
0 libsystem_kernel.dylib 0x1b3ee73c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b4a28eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1b4a245c start_wqthread + 8
正如布兰登指示的那样,使用willdisplaycell并添加新的单元格内容标签,每个卷轴都可能是问题。我当时使用了Willdisplaycell,因为我需要在其中一个单元格中添加一个子视图标签。
因此,我不用使用Willdisplaycell,而是在故事书中为每个单元格创建了IBOUTLET,请为每个单元格创建iboutlet,请设置单元格文本标签并从中加载单元格。在ViewDidload中。这似乎效果很好,应该更稳定。
感谢您的协助Brandon,只需要有人指出明显的。