为什么有exc_breakpoint?

时间:2015-10-08 12:57:34

标签: ios swift

我在故事板中的viewcontroller上有一个tableview nib,所以我可以执行segues。目前我已将第一个nib放在viewcontroller上,但当我didSelectRowAtIndexPath并且转到另一个viewcontroller时,我得到exc_breakpoint错误。

enter image description here

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let concerts = arrayOfConcerts[indexPath.row]
    let artistconcert: ArtistConcerts = self.storyboard?.instantiateViewControllerWithIdentifier("concertartist") as! ArtistConcerts
    print(indexPath.row)
    self.presentViewController(artistconcert, animated: true, completion: nil)
    //artistconcert.
}

以下是ArtistConcerts的代码

class ArtistConcerts: UIViewController, UITableViewDataSource, UITableViewDelegate {


@IBOutlet weak var tableartist: UITableView!
var arrayOfArtists: [concert] = [concert]()



override func viewDidLoad() {
    super.viewDidLoad()
    self.setUpArtists()
    self.loadViewFromNib()
    let nib = UINib(nibName: "LiveConcerts", bundle: nil)
    tableartist.registerNib(nib, forCellReuseIdentifier: "cell")
 func loadViewFromNib(){
    NSBundle.mainBundle().loadNibNamed("ArtistsConcerts", owner: self, options: nil)
    print("in viewcontroller")
}

func setUpArtists(){
    let Strokes = concert(imageName: "")
    arrayOfArtists.append(Strokes)

}
 func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return arrayOfArtists.count

}

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

    let artists = arrayOfArtists[indexPath.row]

    cell.setCell(artists.imageName)

    return cell

   }

}

2 个答案:

答案 0 :(得分:0)

似乎你已经在网上崩溃了 //div[@id='bodyDiv']/p/child::text()

您确定,故事板中有一个视图控制器,其中包含更加正确的let artistconcert: ArtistConcerts = self.storyboard?.instantiateViewControllerWithIdentifier("concertartist") as! ArtistConcerts 和正确的模块名称。

答案 1 :(得分:0)

更改

上可选的self.storyboard
let storyboard = UIStoryboard(name: "YourStoryBoardName", bundle: NSBundle.mainBundle())