本文主要介绍如何防止Foundation当中的常见崩溃处理
熟悉又讨厌的崩溃
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103dca126 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x0000000103c54f78 objc_exception_throw + 48
2 CoreFoundation 0x0000000103e46cdb _CFThrowFormattedException + 194
3 CoreFoundation 0x0000000103e5221e -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
4 CoreFoundation 0x0000000103e351f7 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 227
5 CoreFoundation 0x0000000103dc8da3 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
6 KJExtensionHandler 0x00000001033b715f -[ViewController viewDidLoad] + 815
7 UIKitCore 0x000000010d7ac73b -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 88
8 UIKitCore 0x000000010d7b1022 -[UIViewController loadViewIfRequired] + 1084
9 UIKitCore 0x000000010d6e800e -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 162
10 UIKitCore 0x000000010d6e82f8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 154
11 UIKitCore 0x000000010d6e9371 -[UINavigationController _startDeferredTransitionIfNeeded:] + 851
12 UIKitCore 0x000000010d6ea6dc -[UINavigationController __viewWillLayoutSubviews] + 150
13 UIKitCore 0x000000010d6caf1e -[UILayoutContainerView layoutSubviews] + 217
14 UIKitCore 0x000000010e43d9ce -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2874
15 QuartzCore 0x0000000105546d87 -[CALayer layoutSub