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

问题描述 投票:1回答:2

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

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

当使用storyboard 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
ios swift uistoryboardsegue
2个回答
2
投票

我注意到Xcode在工作应用程序和崩溃应用程序之间的时间内更新了。我从Xcode 10.2回滚到10.1,现在崩溃消失了,app工作正常。

回滚是一种解决方法,而非修复。

问题出在我使用的一个pod(称为Inputmask)中,同​​时问题在pod中得到修复,现在所有这些问题都适用于Xcode 10.2。


0
投票

谢谢Tom Spee节省了我很多时间。

我有同样的问题。我只是用迦太基而不是cocoapods。

该问题出现在InputMask库4.1.0版本中,该问题已在其4.1.1版本中得到修复

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

© www.soinside.com 2019 - 2024. All rights reserved.