iOS 12 SDK 需要自动布局?

iOS 12 SDK require autolayout?

我在 Xcode 10 中使用 iOS SDK 12 开始了一个新项目。我选择了 Master-Detail App 模板。我可以 运行 从一开始就使用该应用程序,而无需对项目进行任何更改,并且它可以正常工作。但是,当我所做的唯一更改是关闭 Main.storyboard 中的自动布局时,应用程序在主视图中选择一个项目并将其发送到详细视图时崩溃。尽管我所做的唯一更改是关闭自动布局。

iOS12 SDK 是否需要自动布局?

在 Xcode 9 中,在主从应用程序模板中关闭自动布局不会导致此崩溃。

任何帮助将不胜感激,我知道我应该过渡到自动布局而不是手动完成所有事情,但我已经做到了。

下面是吐出的错误。

    2018-10-08 11:16:02.968981-0400 Trial2[1100:19064] -[DetailViewController topViewController]: unrecognized selector sent to instance 0x7fbb3652b350
2018-10-08 11:16:02.981283-0400 Trial2[1100:19064] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController topViewController]: unrecognized selector sent to instance 0x7fbb3652b350'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f2ce29b __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010df3f735 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f2ecfa4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKitCore                           0x0000000111cac163 -[UIResponder doesNotRecognizeSelector:] + 287
    4   CoreFoundation                      0x000000010f2d2fb6 ___forwarding___ + 1446
    5   CoreFoundation                      0x000000010f2d4e88 _CF_forwarding_prep_0 + 120
    6   Trial2                              0x000000010d61d049 -[MasterViewController prepareForSegue:sender:] + 361
    7   UIKitCore                           0x0000000111dc05c7 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 182
    8   UIKitCore                           0x0000000111dc04e3 -[UIStoryboardSegueTemplate _perform:] + 82
    9   UIKitCore                           0x0000000111dc07a5 -[UIStoryboardSegueTemplate perform:] + 157
    10  UIKitCore                           0x0000000111e19cbb -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1703
    11  UIKitCore                           0x0000000111e19f44 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 344
    12  UIKitCore                           0x00000001118d097e _runAfterCACommitDeferredBlocks + 318
    13  UIKitCore                           0x00000001118bf424 _cleanUpAfterCAFlushAndRunDeferredBlocks + 384
    14  UIKitCore                           0x00000001118ee870 _afterCACommitHandler + 135
    15  CoreFoundation                      0x000000010f231037 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    16  CoreFoundation                      0x000000010f22b4ce __CFRunLoopDoObservers + 430
    17  CoreFoundation                      0x000000010f22bb61 __CFRunLoopRun + 1537
    18  CoreFoundation                      0x000000010f22b221 CFRunLoopRunSpecific + 625
    19  GraphicsServices                    0x00000001175f91dd GSEventRunModal + 62
    20  UIKitCore                           0x00000001118c5115 UIApplicationMain + 140
    21  Trial2                              0x000000010d61bef0 main + 112
    22  libdyld.dylib                       0x000000011099b551 start + 1
    23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

在 Stephen Darlington 的回答后更新

第一张图是项目创建时的Initial Storyboard。 第二张图是自动布局关闭时故事板是如何改变的。

这与自动布局无关。 "Manual" 仍然完全支持布局;自动布局只是 Apple 的首选方法。

相反,错误出现在堆栈跟踪的第一行:

-[DetailViewController topViewController]: unrecognized selector sent to instance 0x7fbb3652b350

看起来 UINavigationController 已被删除,topViewController 被发送到视图控制器。