2015-06-01 47 views
0

此問題已被問到&之前解決,但我還沒有找到解決方案,解決了我的問題。爲什麼我得到這個「場景由於缺乏入口點而無法訪問,並且沒有通過」instantiateViewControllerWithIdentifier「錯誤的運行時訪問標識符?當我運行的應用程序,在啓動圖像後,它只是變成黑色&調試器有以下消息:由於缺少入口點,無法訪問場景..運行時訪問沒有標識符?

enter image description here

我的默認TableViewController(這是我的第一個)被實例化用下面的代碼中:

import UIKit 

class FirstTableViewController: UITableViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 

    // MARK: - Table view data source 

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 
     // #warning Potentially incomplete method implementation. 
     // Return the number of sections. 
     return 1 
    } 

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
     // #warning Incomplete method implementation. 
     // Return the number of rows in the section. 
     return 21 
    } 

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
     let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell 


     return cell 
    } 

} 

和我的以下兩個tableViewControllers也實例化。什麼似乎是這個問題?

+0

我想你的Storyboard中有另一個場景不能通過segue訪問,也沒有設置標識符。因此,請使用segue連接它或在Identity Inspector中設置一個Storyboard ID。使用ID可以使用instantiateViewControllerWithIdentifier實例化ViewController。 – Pierre

回答

0

在你的故事板中,確保你的初始視圖控制器有一個指向它的箭頭。如果沒有,請在該視圖控制器的檢查器窗口中檢查「初始視圖控制器」。

應用程序找不到初始視圖控制器,這是它的所有抱怨。

+0

是的,這是有效的,應用程序相應運行,但錯誤仍然存​​在。這是爲什麼? –

+0

該應用程序是否顯示正確的主屏幕? – Schemetrical

+0

是的,它顯示了一個表格視圖。 –

相關問題