Error: unreachable because it has no entry points

2020-05-23 02:05发布

Using Swift I got the error that my "TableViewController" is unreachable because it has no entry points and no runtime access via [UIStoryboard instantiateViewControllerWithIdentifier].

In my View Controller class there is the suggestion to fix it while changing instantiateViewController(withIdentfier...) in instantiateViewController(withIdentifier).

Shall I do this or how do I fix this?

标签: ios swift
11条回答
狗以群分
2楼-- · 2020-05-23 02:46

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.

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.

查看更多
冷血范
3楼-- · 2020-05-23 02:48

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.

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:].

The View controller name was the text in quotes, i.e. “View Controller“.

Hope this helped someone!

查看更多
Ridiculous、
4楼-- · 2020-05-23 02:51

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" enter image description here

OR you can give a unique storyboard id for each and every UInavigationcontrollers or UIViewcontrollers or UITabviewcontrollers in your storyboard.

查看更多
乱世女痞
5楼-- · 2020-05-23 02:52

Set Your TableViewController an Initial View Controller from the Storyboard

enter image description here

查看更多
Animai°情兽
6楼-- · 2020-05-23 02:52

I had same issue that to solve this problem I opened the Document Outline then realized that I have accidentally deleted the Segue between two pages.

Steps:

1) Editor> Show Document Outline document outline

2) Check the Document Outline for any copy-paste, segue error or etc. screenshot

查看更多
We Are One
7楼-- · 2020-05-23 02:55

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.

enter image description here

查看更多
登录 后发表回答