I was running my iPhone app just fine yesterday. Today I'm getting this crash:
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
It happens when going from one view to another with storyboard segue (also tried it programmatically). The destination view controller is a UITableViewController with nothing strange. I've rolled back my code to check if anything changed that causes this crash but nothing. Latest test build I made still works fine with same code.
Anybody have any idea what could be wrong? I'm out of ideas.
This is the stack trace:
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
Thank you Tom Spee for saving so much of my time.
I had the exact same problem. I was just using carthage instead of cocoapods.
The issue was present in the InputMask library version 4.1.0 and the issue has been fixed in its version 4.1.1
For more information on the commit that fixed crash, here is the link: https://github.com/RedMadRobot/input-mask-ios/commit/c2f0d9bcc49567a6c0bcc4173dd410a969fcc423
I noticed that Xcode was updated in the time between working app and crashing app. I rolled back from Xcode 10.2 to 10.1 and now the crash is gone, app is working fine.
Rolling back was a workaround, not a fix.
The problem was in a pod I used (called Inputmask), the problem is fixed in the pod in the meantime and all works fine now with Xcode 10.2.