XCode 在路径上没有有效的编译故事板

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29563618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:57:17  来源:igfitidea点击:

XCode no valid compiled storyboard at path

iosobjective-cxcodestoryboard

提问by AlBirdie

I've got a universal XCode Project (ObjC) for iPad and iPhone with a subproject that contains a storyboard. The subproject is a static library that has been added to the main project. Included in this subproject is a bundle containing bespoken storyboard.

我有一个适用于 iPad 和 iPhone 的通用 XCode 项目 (ObjC),其中包含一个包含情节提要的子项目。子项目是添加到主项目中的静态库。此子项目中包含一个包含定制故事板的包。

Whenenver I tap a certain button the application, the storyboard needs to be loaded;

当我点击应用程序的某个按钮时,需要加载故事板;

[UIStoryboard storyboardWithName:@"UIControls.bundle/Config" bundle:nil];

That works perfectly fine for the iPhone (devices and simulators), but whenever I try to run the project an an iPad (device or simulator), I'm getting the following error;

这对于 iPhone(设备和模拟器)非常有效,但是每当我尝试在 iPad(设备或模拟器)上运行项目时,我都会收到以下错误;

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'There doesn't seem to be a valid compiled storyboard at path...

What's the about? The project is a universal project, so why can't the iPad find the storyboard?

是怎么回事?项目是通用项目,为什么iPad找不到storyboard?

回答by AlBirdie

To answer my own question;

回答我自己的问题;

This error appears when the bundle target isn't universal. So make sure the Targeted Device Family in the bundle's build settings is set to iPhone AND iPad.

当捆绑目标不通用时会出现此错误。因此,请确保捆绑包构建设置中的目标设备系列设置为 iPhone 和 iPad。

enter image description here

在此处输入图片说明

回答by stephenspann

Just ran into this, after switching a project from a Universal target to iPad only, and the deployment target from iOS 9.0 to iOS 7.1.

在将项目从通用目标切换到仅 iPad,并将部署目标从 iOS 9.0 切换到 iOS 7.1 之后,刚刚遇到了这个问题。

The solution was to disable 'Use Size Classes' on the storyboard, and only keep the sizes for iPad.

解决方案是在故事板上禁用“使用尺寸类”,只保留 iPad 的尺寸。

To get to this checkbox, open the storyboard in the project navigator, then select then show the File Inspector (first icon) and scroll down to Interface Builder Document heading.

要访问此复选框,请在项目导航器中打开故事板,然后选择然后显示文件检查器(第一个图标)并向下滚动到 Interface Builder Document 标题。

回答by endowzoner

I was using a Storyboard from a custom Cocoapod and it kept crashing with

我正在使用来自自定义 Cocoapod 的 Storyboard 并且它不断崩溃

There doesn't seem to be a "valid compiled storyboard" at path ...

路径上似乎没有“有效的编译故事板”......

In the affected storyboard, under Interface Builder Document I switched the "Builds for" value from "iOS 7.0 or later" to "Project Deployment Target" (which was 9.0), this did the trick for me.

在受影响的故事板中,在 Interface Builder Document 下,我将“Builds for”值从“iOS 7.0 或更高版本”切换到“项目部署目标”(9.0),这对我有用。

回答by seaders

In our case, we were running a shell script that executed one of XCode's commandline tools, ibtool,

在我们的例子中,我们正在运行一个 shell 脚本,该脚本执行 XCode 的命令行工具之一ibtool

ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target 6.0 --output-format human-readable-text --compile ./Build/Release-iphonesimulator/TestApp.app/TestStoryboard.storyboardc ./Resources/TestStoryboard.storyboard --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk

and while it seemedto run without errors, it actually produced an empty storyboardcdirectory. Upgrading the minimum deployment target to 8.0 produced a properly constructed storyboardc, with an Info.plistfile inside. When IBTool fails / produces an empty directory, I definitely think it should actually fail, and cease compilation, because otherwise everything looks like it's properly set up and correct, it actually isn't.

虽然它似乎没有错误地运行,但它实际上产生了一个空storyboardc目录。将最小部署目标升级到 8.0 会生成一个正确构造的storyboardc,其中包含一个Info.plist文件。当 IBTool 失败/产生一个空目录时,我绝对认为它实际上应该失败并停止编译,否则一切看起来都已正确设置和正确,但实际上并非如此。

So yeah, solution for us was upgrading the minimum deployment target of our app.

所以是的,我们的解决方案是升级我们应用程序的最低部署目标。

回答by Irrr Riiiiiii

I had this problem due to changes in the Storyboard color of Status Bar Style and not changed in project settings

由于状态栏样式的故事板颜色发生了变化,并且在项目设置中没有发生变化,我遇到了这个问题

回答by NazarYavornytskyy

For me solution is:

对我来说,解决方案是:

I used this code to load a new view controller - [UIStoryboard storyboardWithName:@"UIViewController" bundle:nil];

我用这段代码加载了一个新的视图控制器 - [UIStoryboard storyboardWithName:@"UIViewController" bundle:nil];

First I tried - [UIStoryboard storyboardWithName:@"UIViewController" bundle:[NSBundle mainBandle]];

首先我尝试 - [UIStoryboard storyboardWithName:@"UIViewController" bundle:[NSBundle mainBandle]];

But no lucky, finally I changed this code to:

但不走运,最后我将此代码更改为:

[self performSegueWithIdentifier:@"Segue" sender:self];

[self performSegueWithIdentifier:@"Segue" sender:self];

And it helped, maybe it can help somebody too.

它有帮助,也许它也可以帮助某人。

回答by toxicsun

Had the same issue. Solved it buy adding libc++.tbdin Link Bindary with Libraries.

有同样的问题。解决它买加libc++.tbdLink Bindary with Libraries

回答by saltwat5r

I'm sorry for my previous comments.
I don't know why it didn't work, but currently I fixed that problem with following steps:

我很抱歉我之前的评论。
我不知道为什么它不起作用,但目前我通过以下步骤解决了这个问题:

  1. Go to Project Target -> Info and then delete KeyValue object for key Main storyboard file base nameand Main storyboard file base name (iPad).
  2. To ensure that it's completely removed, go to Info.plist file and verify the KeyValue objects aren't exist there. If they are, then also delete from there.
  3. Remove references to Storyboards from Xcode project.
  4. Add Storyboards back to the project by right-click on the project in Xcode -> Add files to project_name, tick the Copy items if needed, Create groupsand project target options.
  5. Set Storyboards names both for iPhone and iPad in Project Target –> Info, by adding previously removed KeyValue objects.
  1. 转到 Project Target -> Info,然后删除键Main storyboard file base nameMain storyboard file base name (iPad) 的KeyValue 对象。
  2. 为了确保它被完全删除,转到 Info.plist 文件并验证 KeyValue 对象在那里不存在。如果是,那么也从那里删除。
  3. 从 Xcode 项目中删除对 Storyboards 的引用。
  4. 通过在 Xcode 中右键单击项目 -> 将文件添加到project_name,将 Storyboards 添加回项目,如果需要,勾选复制项目创建组和项目目标选项。
  5. 通过添加之前删除的 KeyValue 对象,在 Project Target –> Info 中为 iPhone 和 iPad 设置 Storyboards 名称。

From now Storyboards work as previously!

从现在开始,故事板像以前一样工作!

回答by nahlamortada

I was trying to fix this problem for 2 days with no hope till i found that it also did not open the sqlite DB file also and after that everything is corrupted after this DB failure. that was my case. And all of that was a memory issue even if ARC set arrays or dictionaries after finishing to nil;

我试图解决这个问题 2 天没有希望,直到我发现它也没有打开 sqlite DB 文件,然后在这个 DB 失败后一切都被破坏了。这就是我的情况。即使ARC在完成后将数组或字典设置为nil,所有这些都是内存问题;