当我运行我的应用程序并尝试按下按钮时,我看到:
Thread 1 EXC_BAD_INSTRUCTION.
代码如下:
import UIKit
class DeveloperViewController: UITableViewController {
@IBAction func cancelToPlayersViewController(segue:UIStoryboardSegue){
}
@IBAction func saveDeveloperDetail(segue:UIStoryboardSegue){
if let developerDetailsViewController = segue.sourceViewController as? DeveloperDetailsViewController{
developers.append(developerDetailsViewController.developer) //Here Thread 1
let indexPath = NSIndexPath(forRow: developers.count-1, inSection: 0)
tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
}
var developers: [Developers] = developersData
// 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 {
return developers.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("DeveloperCell", forIndexPath: indexPath)
as! UITableViewCell
let developer = developers [indexPath.row] as Developers
cell.textLabel?.text = developer.name
cell.detailTextLabel?.text = developer.type
return cell
}
我怎样才能解决我的问题?
在另一个程序中,所有程序都工作。
最佳答案
我发现了我的错误!
但如果DDPWNAGE不询问错误日志说什么,就没有找到它。
我忘了带一个身份证。
现在一切正常
关于ios - iOS-Xcode线程1 EXC_BAD_INSTRUCTION,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29755530/