You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS应用真机构建正常但模拟器启动崩溃,提示找不到'Main'故事板的问题求助

iOS应用真机构建正常但模拟器启动崩溃,提示找不到'Main'故事板的问题求助

大家好,我遇到了一个棘手的问题,想请教下社区的各位:

我一直在用真机开发我的iOS应用,过去几个星期里做了几百次构建,一切都正常。但现在我需要测试一个需要模拟定位的功能,真机没法实现这个操作,所以不得不尝试在模拟器上构建运行。结果刚启动App(不管是手动启动还是Xcode自动启动)就直接崩溃了,崩溃日志如下:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle </Users/[...]/Library/Developer/CoreSimulator/Devices/7F88C881-9905-4665-AC11-282A5171CCAC/data/Containers/Bundle/Application/65ABEA43-53A1-4181-A8F4-AD87D9CCA49B/[...].app> (loaded)'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a3677d4 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000010681b7cc objc_exception_throw + 72
2 UIKitCore 0x0000000145d7f1f0 -[UIStoryboard name] + 0
3 UIKitCore 0x0000000145bd6810 -[UIApplication _storyboardInitialMenu] + 112
4 UIKitCore 0x0000000145bf3544 -[UIApplication buildMenuWithBuilder:] + 44
5 UIKitCore 0x00000001460f2cec -[UIMenuSystem _buildMenuWithBuilder:fromResponderChain:atLocation:inCoordinateSpace:] + 92
6 UIKitCore 0x000000014501b900 -[_UIMainMenuSystem _buildMenuWithBuilder:fromResponderChain:atLocation:inCoordinateSpace:] + 112
7 UIKitCore 0x00000001460f2c2c -[UIMenuSystem _newBuilderFromResponderChain:atLocation:inCoordinateSpace:] + 96
8 UIKitCore 0x000000014501b7d4 -[_UIMainMenuSystem _automaticallyRebuildIfNeeded] + 172
9 UIKitCore 0x000000014501b80c -[_UIMainMenuSystem _keyCommands] + 20
10 UIKitCore 0x0000000145beeeec -[UIApplication _keyCommands] + 80
11 UIKitCore 0x0000000145bffab0 -[UIResponder _enumerateKeyCommandsInChainWithOptions:usingBlock:] + 436
12 UIKitCore 0x0000000145beeb74 -[UIApplication _immediatelyUpdateSerializableKeyCommandsForResponder:] + 164
13 UIKitCore 0x00000001460eb9a8 -[_UIAfterCACommitBlock run] + 64
14 UIKitCore 0x00000001460ebdbc -[_UIAfterCACommitQueue flush] + 164
15 UIKitCore 0x0000000145bdf54c _runAfterCACommitDeferredBlocks + 256
16 UIKitCore 0x0000000145bd1028 _cleanUpAfterCAFlushAndRunDeferredBlocks + 76
17 CoreFoundation 0x000000010a2c7134 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
18 CoreFoundation 0x000000010a2c6898 __CFRunLoopDoBlocks + 348
19 CoreFoundation 0x000000010a2c1450 __CFRunLoopRun + 808
20 CoreFoundation 0x000000010a2c0cec CFRunLoopRunSpecific + 536
21 GraphicsServices 0x000000011f51ad00 GSEventRunModal + 164
22 UIKitCore 0x0000000145bd27d4 -[UIApplication _run] + 796
23 UIKitCore 0x0000000145bd6ba0 UIApplicationMain + 124
24 UIKitCore 0x0000000144f9cf1c block_destroy_helper.14 + 9560
25 [...].debug.dylib 0x0000000107067cdc $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 128
26 [...].debug.dylib 0x0000000107067c4c $s4[...]11AppDelegateC5$mainyyFZ + 44
27 [...].debug.dylib 0x0000000107067d58 __debug_main_executable_dylib_entry_point + 28
28 dyld 0x00000001046113d4 start_sim + 20
29 ??? 0x000000010470ab98 0x0 + 4369460120
)
libc++abi: terminating due to uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle </Users/[...]/Library/Developer/CoreSimulator/Devices/7F88C881-9905-4665-AC11-282A5171CCAC/data/Containers/Bundle/Application/65ABEA43-53A1-4181-A8F4-AD87D9CCA49B/[...].app> (loaded)'
terminating due to uncaught exception of type NSException
CoreSimulator 1010.15 - Device: iPhone 16 Pro (7F88C881-9905-4665-AC11-282A5171CCAC) - Runtime: iOS 18.5 (22F77) - DeviceType: iPhone 16 Pro

从日志能看出来,App在找一个叫'Main'的故事板,但我从项目创建第一天开始就完全用代码编写所有UI,根本没添加过任何故事板文件。

我已经做了这些排查步骤:

  • 检查Launch Screen的设置,确认里面没有引用故事板(本来就是空的)
  • 全局搜索Info.plist,确认没有任何'Main'或者Storyboard相关的配置项
  • 检查项目的Deployment Target,确认设置的是iPhone(不是通用或其他)

现在我怀疑会不会是某个第三方依赖在内部引用了故事板?如果真的是这个原因,我该怎么排查出是哪个依赖导致的呢?麻烦各位给点思路,谢谢了!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 13:08:04