LoginSignup
16
7

More than 5 years have passed since last update.

“View Controller“ is unreachable because it has no entry points, and no identifier for runtime access…の警告は Is Initial View Controllerがないせいかも?

Last updated at Posted at 2019-04-21

書いた理由

“View Controller“ is unreachable because it has no entry points, and no identifier for runtime accessでググっても、後述の解決方法しか出てこなかったため

警告文

“NavigationController“ is unreachable because it has no entry points, and no identifier for runtime access

View Controller の部分にはNavigationControllerが入ったりView Controllerだったり
それぞれの開発環境によって変わります。

※以下、ViewController = VC

検索すると出てくる解決方法

以下の方法でも思惑と合致していれば良いのですが、求めている解決方法は違うかもしれません。

  • 使用していないViewControllerは削除する
  • Storyboard ID をつける

使用していないViewControllerは削除する
→使用するViewControllerだから作ったのでは?

Storyboard ID をつける
→ IDを使うならいいんですが、そうじゃないんならただのその場しのぎになってしまう…

もしかして

Is Initial View Controllerは設定していますか?
Is Initial View Controllerとは、そのStoryboard内で最初に表示するVCのことです

スクリーンショット 2019-04-21 21.58.37.png

表題の警告文は、
Is Initial View Controllerに設定されているわけでもなく、
StoryboardIDも設定していない場合に表示されるものですね。

もし、対象のViewControllerがそのStoryboardで最初に表示されてほしいVCであれば、
Is Initial View Controllerを設定することで解決します。

最初に表示したVCではない場合は、他のVCからSegueを繋ぐか、Storyboard ID を設定しましょう!

設定方法

Attributes Inspector に Is Initial View Controllerという項目がありますので、チェックボックスをチェックしましょう
以上です。

スクリーンショット 2019-04-21 22.01.34.png

おまけ

NavigationControllerを後から追加するときは、VCを選択して右下のEmbed in ボタンから簡単に追加することができます。
スクリーンショット 2019-04-21 9.47.36.png

自動でNCとVCが繋がるので便利ですね。

このボタンはStack Viewにまとめたり、割と便利なので積極的に使っていきましょう!

参考リンク

16
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
7