因此,我在构建一个表视图时,主要是基于这个苹果教程创建表视图,但在运行我的应用程序时遇到了一个问题。问题是,当我运行应用程序时,我收到了非常可怕的SIGABRT错误。
注1:只有在loadlist()在ViewDidLoad中时才会得到SIGABRT错误
,所以我添加了一个豁免断点,并得到了以下错误:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/SiriTasks.framework/SiriTasks和/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/PhotosUI.framework/PhotosUI.都实现了类STGenericIntentDateRange两个中的一个将被使用。哪个是未定的。/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/GameCenterFoundation.framework/GameCenterFoundation和/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/GameplayKit.framework/GameplayKit.都实现了类GKStateMachine两个中的一个将被使用。哪个是未定的。(十一分贝)
,我的TableViewController看起来像这样:
import UIKit
class LevelTableViewController: UITableViewController {
var levelsArray = [Level]()
override func viewDidLoad() {
super.viewDidLoad()
//Load the data
loadlist()
}
func loadlist(){
let Level1:Level = Level(name: "Level1")!
levelsArray += [Level1]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return levelsArray.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellid = "LevelTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellid, forIndexPath: indexPath) as! LevelTableViewCell
// Fetches the appropriate meal for the data source layout.
let Level = levelsArray[indexPath.row]
cell.ListName.text = Level.name
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}和我的TableViewCell:
import UIKit类LevelTableViewCell: UITableViewCell {
//Declaration of properties
@IBOutlet weak var ListName: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}}和我的类定义如下:
import Foundation
import UIKit
class Level {
// MARK: Properties
var name: String
init?(name: String) {
// Initialize stored properties.
self.name = name
if name.isEmpty {
return nil
}
}
}我们将非常感谢您的帮助。
发布于 2015-09-08 18:23:11
检查这些类是否与这两个框架中的类相同。如果它们是重复的,但几乎没有区别,您可以尝试删除一个版本,然后用不同的名称再次添加它们。请注意,此选项可能需要一些更改,因为可以从代码中的更多点调用这些类。如果类相同,请尝试使用Finder查找它们,复制,从项目导航器中删除它们,然后再试一次。如果出现严重问题,请将它们再次添加到您的项目中,不要忘记检查“复制项”。
https://stackoverflow.com/questions/32455559
复制相似问题