我是新的IOS人员。 我只是遇到了一个情况,我无法弄清楚原因。如果有人能提出一些建议,真的很感激。
我的问题非常类似于这个家伙的问题: IOS-Convert code-based interface to Storyboard based interface
我的控制台信息是:
* Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Could not find a storyboard named 'Main' in bundle NSBundle (loaded)'
* First throw call stack: (0x184c2a530 0x195bac0e4 0x189a04484 0x1896c4590
0x1896c3728 0x1896c1f1c 0x18d0f1604 0x184be2d70 0x184be1e78 0x184be0078
0x184b0d1f4 0x1894a3020 0x18949e10c 0x10005fd68 0x19622aa08) libc++abi.dylib:
terminating with uncaught exception of type NSException (lldb)
答案 0 :(得分:0)
您是否将故事板命名为Main?我的建议是创建一个新项目,并将当前项目的Info.plist与新项目进行比较。
如果您希望应用打开故事板,则应将其添加到该行:
Main storyboard file base name
从源代码中可以看出: UIMainStoryboardFile 主
示例Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.bulenapps.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
答案 1 :(得分:0)
请在didFinishLaunch方法中编辑appDelegate.m文件并试一下..
_serialManager = [[RscMgr alloc] init];
DetectionViewModel * detectionViewModel = [[DetectionViewModel alloc] initWithSerialManager:_serialManager];
UIStoryboard * aStoryBorad = [UIStoryboard storyboardWithName:@“Main”bundle:nil];
_viewController = aStoryBorad instantiateViewControllerWithIdentifier:@“_ viewController”];
由于 问候 与Hemant