您现在的位置: IOS教程網 >> IOS系統 >  >> iOS 使用技巧 >> iOS 技巧大全

Xcode 常見錯誤排查:the designated entry point is not set

編輯:iOS 技巧大全

刪掉預設的 ViewController、自己新增一個 TableViewController 之後,一 Run 就遇到這行錯誤訊息:

Perhaps the designated entry point is not set?

原因

這個錯誤的意思是「找不到指定的進入點」。Storyboards 需要知道哪一個 scene 是啟動畫面,而新增的 TableViewController 預設並沒有被標記為入口——因此 App 啟動時無從下手。

解法

  1. 在 Storyboard 中選中你新增的那個 ViewController
  2. 開啟右側的 Attributes Inspector(Option + Command + 3)
  3. 在「View Controller」區塊中找到 Is Initial View Controller,把它勾選起來

設定後再次執行即可正常啟動。

補充

  • 勾選之後,該 scene 的左側邊條會出現一個灰色箭頭,指向它就是啟動入口。
  • 若專案是完全用程式碼建立視圖(沒有 Storyboard),則必須在 AppDelegate 中自行設定 self.window.rootViewController,否則也會出現類似症狀。
  • 若只有一個 scene 卻仍報錯,也要檢查 Target 的 Deployment Info 中「Main Interface」是否指向正確的 storyboard 檔名。
  1. 上一篇文章:
  2. 下一篇文章:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © IOS教程網 All Rights Reserved