NSGenericException:该编码器要求从initWithCoder返回替换的对象

时间:2019-03-28 10:32:47

标签: ios swift uistoryboardsegue

昨天我运行我的iPhone应用程序很好。今天我遇到了崩溃:

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'

当使用情节提要segue从一个视图转到另一个视图时(也可以通过编程尝试),就会发生这种情况。目标视图控制器是一个UITableViewController,毫不奇怪。我回滚了代码,以检查是否有任何更改导致此崩溃,但是什么也没有。我制作的最新测试版本在相同的代码下仍然可以正常工作。

任何人都知道什么地方可能出问题了?我没主意了。

这是堆栈跟踪:

0   CoreFoundation                      0x0000000107f176fb __exceptionPreprocess + 331
1   libobjc.A.dylib                     0x0000000106f0bac5 objc_exception_throw + 48
2   CoreFoundation                      0x0000000107f17555 +[NSException raise:format:] + 197
3   UIFoundation                        0x000000010d3fe89c UINibDecoderDecodeObjectForValue + 827
4   UIFoundation                        0x000000010d3feaf9 UINibDecoderDecodeObjectForValue + 1432
5   UIFoundation                        0x000000010d3fe554 -[UINibDecoder decodeObjectForKey:] + 251
6   UIKitCore                           0x000000010f4b0330 -[UIViewController initWithCoder:] + 1021
7   UIKitCore                           0x000000010f4a52ab -[UITableViewController initWithCoder:] + 59
8   Tankey                              0x0000000100c8ede4 $s6Tankey25BaseUITableViewControllerC5coderACSgSo7NSCoderC_tcfc + 148
9   Tankey                              0x0000000100c8ee8f $s6Tankey25BaseUITableViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 47
10  Tankey                              0x0000000100bcd3fc $s6Tankey19ShareViewControllerC5coderACSgSo7NSCoderC_tcfc + 1260
11  Tankey                              0x0000000100bcd4bf $s6Tankey19ShareViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 47
12  UIKitCore                           0x000000010f7354f9 -[UIClassSwapper initWithCoder:] + 246
13  UIFoundation                        0x000000010d3fe852 UINibDecoderDecodeObjectForValue + 753
14  UIFoundation                        0x000000010d3fe554 -[UINibDecoder decodeObjectForKey:] + 251
15  UIKitCore                           0x000000010f739b41 -[UIRuntimeConnection initWithCoder:] + 178
16  UIKitCore                           0x000000010f739ee2 -[UIRuntimeEventConnection initWithCoder:] + 59
17  UIFoundation                        0x000000010d3fe852 UINibDecoderDecodeObjectForValue + 753
18  UIFoundation                        0x000000010d3feaf9 UINibDecoderDecodeObjectForValue + 1432
19  UIFoundation                        0x000000010d3fe554 -[UINibDecoder decodeObjectForKey:] + 251
20  UIKitCore                           0x000000010f7373f1 -[UINib instantiateWithOwner:options:] + 1216
21  UIKitCore                           0x000000010fc4fc60 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
22  UIKitCore                           0x000000010fc507fb -[UIStoryboardSegueTemplate instantiateOrFindDestinationViewControllerWithSender:] + 90
23  UIKitCore                           0x000000010fc50a3f -[UIStoryboardSegueTemplate _perform:] + 52
24  UIKitCore                           0x000000010f4b854b -[UIViewController performSegueWithIdentifier:sender:] + 99
25  UIKit                               0x0000000127bdeec1 -[UIViewControllerAccessibility performSegueWithIdentifier:sender:] + 102
26  Tankey                              0x0000000100affb30 $s6Tankey22SettingsViewControllerC05tableC0_14didSelectRowAtySo07UITableC0C_10Foundation9IndexPathVtF + 1280
27  Tankey                              0x0000000100b0047e $s6Tankey22SettingsViewControllerC05tableC0_14didSelectRowAtySo07UITableC0C_10Foundation9IndexPathVtFTo + 158
28  UIKitCore                           0x000000010fcd2419 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1810
29  UIKitCore                           0x000000010fcd262d -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 337
30  UIKitCore                           0x000000010fac2cc9 _runAfterCACommitDeferredBlocks + 318
31  UIKitCore                           0x000000010fab2199 _cleanUpAfterCAFlushAndRunDeferredBlocks + 358
32  UIKitCore                           0x000000010fadf32b _afterCACommitHandler + 124
33  CoreFoundation                      0x0000000107e7e0f7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
34  CoreFoundation                      0x0000000107e785be __CFRunLoopDoObservers + 430
35  CoreFoundation                      0x0000000107e78c31 __CFRunLoopRun + 1505
36  CoreFoundation                      0x0000000107e78302 CFRunLoopRunSpecific + 626
37  GraphicsServices                    0x000000010d0a22fe GSEventRunModal + 65
38  UIKitCore                           0x000000010fab7ba2 UIApplicationMain + 140
39  Tankey                              0x0000000100aee518 main + 72
40  libdyld.dylib                       0x000000010958f541 start + 1
41  ???                                 0x0000000000000001 0x0 + 1

2 个答案:

答案 0 :(得分:2)

我注意到Xcode在正常运行的应用程序和崩溃的应用程序之间进行了更新。我从Xcode 10.2回滚到10.1,现在崩溃消失了,应用程序运行正常。

回滚是一种解决方法,而不是解决方法。

问题出在我使用的Pod(称为Inputmask)中,此问题在此期间已得到解决,现在在Xcode 10.2上一切正常。

答案 1 :(得分:0)

谢谢汤姆·斯佩(Tom Spee)节省了我很多时间。

我有完全相同的问题。我只是在用迦太基而不是可可足。

InputMask库版本4.1.0中存在该问题,而其版本4.1.1中已解决该问题

有关已修复崩溃的提交的更多信息,请参见以下链接: https://github.com/RedMadRobot/input-mask-ios/commit/c2f0d9bcc49567a6c0bcc4173dd410a969fcc423