【问题标题】:How to fix the SIGABRT error如何修复 SIGABRT 错误
【发布时间】:2015-12-04 00:09:19
【问题描述】:

所以我在很大程度上基于这个苹果教程Create a Table View 构建了一个表格视图,但是在运行我的应用程序时遇到了问题。问题是当我运行应用程序时,我收到了可怕的 SIGABRT 错误。

注意 1:当 loadlist() 在 ViewDidLoad 中时,我只会收到 SIGABRT 错误

所以我添加了一个豁免断点,得到了这个错误:

objc[7603]:STGenericIntentDateRange 类在 /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。将使用两者之一。哪一个是未定义的。 objc[7603]:类 GKStateMachine 在 /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。将使用两者之一。哪一个是未定义的。 (lldb)

为了记录,我的 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
    }

   }

 }

我们将不胜感激。

【问题讨论】:

  • 检查 STGenericIntentDateRange 和 GKStateMachine 类的目标成员资格。
  • 没碰过,不知道什么意思

标签: ios xcode uitableview swift2 sigabrt


【解决方案1】:

检查这些类是否重复,因为它们可能在两个框架中。如果它们重复但几乎没有不同,您“可能”尝试删除一个版本并使用不同的名称再次添加它们。请注意,此选项可能需要进行一些更改,因为可以从代码中的更多点调用这些类。 如果类相同,请尝试使用 Finder 查找它们,制作副本,从项目导航器中删除它们,然后重试。如果出现严重错误,只需将它们重新添加到您的项目中,不要忘记检查“复制项目”

【讨论】:

  • 我不再使用游戏中心框架,我使用了,但我删除了它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-09
相关资源
最近更新 更多