ios 错误:无法访问,因为它没有入口点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39847365/
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
Error: unreachable because it has no entry points
提问by Philipp Koopmans
Using Swift I got the error that my "TableViewController" is unreachable because it has no entry points and no runtime access via [UIStoryboard instantiateViewControllerWithIdentifier].
使用 Swift 时,我收到了“TableViewController”无法访问的错误,因为它没有入口点,也没有通过 [UIStoryboard instantiateViewControllerWithIdentifier] 进行的运行时访问。
In my View Controller class there is the suggestion to fix it while changing instantiateViewController(withIdentfier...)
in instantiateViewController(withIdentifier)
.
在我的视图控制器类有解决它而改变的建议instantiateViewController(withIdentfier...)
在instantiateViewController(withIdentifier)
。
Shall I do this or how do I fix this?
我应该这样做还是如何解决这个问题?
回答by Rashwan L
You need to mark a viewController
in your Storyboard
and set it to the initial viewController
. You do this under the Attributes Inspector
. This means that you set which viewController shall open when you start your application.
您需要viewController
在您的中标记 aStoryboard
并将其设置为initial viewController
. 你在Attributes Inspector
. 这意味着您可以设置在启动应用程序时打开哪个 viewController。
回答by Vitya Shurapov
I'd reached the same error. This answer would be useful, I think: Xcode: "Scene is unreachable due to lack of entry points" but can't find it
我遇到了同样的错误。我认为这个答案很有用: Xcode:“由于缺少入口点,场景无法访问”但找不到
The problem wasthat because of some experiments and copy-pasting I hadan actual copyof a view controllerlocated outside the visible part of the screen or it could be stacked exactly on top of its twin. So I just deleted unwanted one :-) You should open Document Outlineand сheck for copies:-)
问题是,由于一些实验和复制粘贴,我有一个视图控制器的实际副本位于屏幕的可见部分之外,或者它可以完全堆叠在其双胞胎的顶部。所以我只是删除了不需要的:-) 你应该打开文档大纲并检查副本:-)
回答by Suhit Patil
回答by Christopher
I fixed this by renaming the default "ViewController.swift" as "MainViewController.swift". Perhaps this is a warning to the user to insure everything is defined as you expect it to be.
我通过将默认的“ViewController.swift”重命名为“MainViewController.swift”来解决这个问题。也许这是对用户的警告,以确保一切都按照您的预期进行定义。
I experienced this issue again and backtracked, eventually clearing the storyboard and then deleting it entirely from the project and the issue was still present. Relaunching Xcode fixed the issue.
我再次遇到这个问题并回溯,最终清除故事板,然后将其从项目中完全删除,但问题仍然存在。重新启动 Xcode 解决了这个问题。
回答by appmaster
For me I just had a view controller that wasn't attached to anything, i.e. I had a UITabBar Controller, and a few View Controllers attached to the TabBar, but there was one View Controller that was stranded, with out any connection to another view.
对我来说,我只有一个没有附加到任何东西的视图控制器,即我有一个 UITabBar 控制器和一些附加到 TabBar 的视图控制器,但是有一个视图控制器被搁浅,与另一个视图没有任何连接.
From my experience, the error message was,
根据我的经验,错误消息是,
“View Controller“ is unreachable because it has no entry points, and no identifier for runtime access via -[UIStoryboard instantiateViewControllerWithIdentifier:].
“视图控制器”无法访问,因为它没有入口点,也没有通过 -[UIStoryboard instantiateViewControllerWithIdentifier:] 进行运行时访问的标识符。
The View controller name was the text in quotes, i.e. “View Controller“.
视图控制器名称是引号中的文本,即“视图控制器”。
Hope this helped someone!
希望这对某人有所帮助!
回答by Abdullah Ah??
回答by Prabhu.Somasundaram
When you have 2 or more navigation controllers(embedded UIVIewcontrollers) or 2 or more UIViewcontrollers in your storyboard. Xcode may be looking for a startup view controller. You can mark either of one of them as startupviewcontroller, just by selecting the "is initial viewcontroller"
当您的故事板中有 2 个或更多导航控制器(嵌入式 UIVIewcontrollers)或 2 个或更多 UIViewcontrollers 时。Xcode 可能正在寻找启动视图控制器。您可以将其中任何一个标记为启动视图控制器,只需选择“是初始视图控制器”
ORyou can give a unique storyboard id for each and every UInavigationcontrollers or UIViewcontrollers or UITabviewcontrollers in your storyboard.
或者,您可以为故事板中的每个 UInavigationcontrollers 或 UIViewcontrollers 或 UITabviewcontrollers 提供唯一的故事板 ID。
回答by oskarko
回答by Mikkel Wind
回答by eowyn
I had same issue that to solve this problem I opened the Document Outlinethen realized that I have accidentally deleted the Seguebetween two pages.
我遇到了同样的问题,为了解决这个问题,我打开了文档大纲,然后意识到我不小心删除了两页之间的Segue。
Steps:
脚步:
1) Editor> Show Document Outline document outline
1) Editor> Show Document Outline 文档大纲
2) Check the Document Outline for any copy-paste
, segue error or etc.
screenshot
2) 检查文档大纲是否有任何copy-paste
、segue 错误或等
截图