Xcode: “Scene is unreachable due to lack of entry

2019-01-16 13:23发布

Xcode 4.5.2 gives me the following warning:

Unsupported Configuration    
Scene is unreachable due to lack of entry points and does not have an identifier 
for runtime access via -instantiateViewControllerWithIdentifier:.

Unfortunately I can't identify the incriminated scene. Selecting the warning in the Issue Navigator doesn't highlight anything in the Storyboard. I have a fairly complicated storyboard (30+ scenes).

Any suggestions?

Screenshot for warning

22条回答
走好不送
2楼-- · 2019-01-16 14:05

I'm afraid you'll have to go through all 30 of them, and check whether they have a Storyboard ID or a segue to that view controller. One of the two is required, both is also an option.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-16 14:07

Here is what worked for me:

  1. Open the storyboard in a text editor.
  2. Change version from 3.0 to 2.0 save and close it.
  3. Open it again in visual studio. It will automatically convert and open the document.
查看更多
男人必须洒脱
4楼-- · 2019-01-16 14:08

You can just set an identifier. On the attribute inspector on the right pane, you'll find a field called "Identifier". Just put any string in there , this should work

You can click on the navigation controller and under the attributes inspector click the button "is initial view controller", and this should work too.

查看更多
放我归山
5楼-- · 2019-01-16 14:08

Maybe this XQuery will help you to find those nasty scenes

for $i in .//scene/objects/*[1][not(@storyboardIdentifier) or @storyboardIdentifier= '']/@id      (: find every scene that has an empty storyboardIdentifier :)
where count(.//segue[@destination= $i])= 0 and $i!= ./document/@initialViewController             (: filter the results to the scenes that are not destinations of a segue and exclude the initialViewController :) 
return ($i, $i/../@customClass)                                                                   (: return the storyboard-id and the customClass, if any :)

If you have xqilla installed, you would save the query to a file and use it like

xqilla <xqueryfile> -i <path to your storyboard>
查看更多
啃猪蹄的小仙女
6楼-- · 2019-01-16 14:09

In your storyboard, select each of the view controller (red arrow in image below) and look at the Storyboard ID field (red oval). None of the Storyboard ID fields should be blank. When you find one that is, that is the culprit.

enter image description here

查看更多
爷、活的狠高调
7楼-- · 2019-01-16 14:09

I tried everything described above to no avail. I had everything connected properly in IB, with exactly one UIViewController designated the root view controller. I had no identifiers but added them to all of my controllers.

The only way I could get the warning to disappear was by doing everything above (including a computer reboot and a clean build) then switching to an error-free branch of my project in git and back again.

Unsure which action fixed it, or which combination of actions, but it wasn't the clean build on its own. This might be a byproduct of Main.storyboard always changing upon simply being opened, which means I have to git commit -m "Stupid storyboard" more often than I want to.

查看更多
登录 后发表回答