应用程序在Xcode(Swift)中有时会在刷卡删除操作时崩溃

时间:2015-09-24 16:32:51

标签: ios xcode swift crash

当我执行滑动删除操作时,我的待办事项列表应用崩溃有时

日志显示以下消息:

ibobjc.A.dylib`objc_msgSend + 11,queue ='com.apple.main-thread',stop reason = EXC_BAD_ACCESS(code = EXC_I386_GPFLT)

我的滑动操作删除代码

func tableView(tableView: UITableView!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) {
        if (editingStyle == UITableViewCellEditingStyle.Delete) {

            toDoList.removeAtIndex(indexPath.row)
            toDoListTable.reloadData()
            NSUserDefaults.standardUserDefaults().setObject(toDoList, forKey: "toDoList")




        }
    }

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

基于Apple Documentation,您应该致电

public void setMultiplayer() throws Exception{ Path origin = Paths.get(System.getProperty("user.home"), "Dropbox", "MTWMultiplayer","propertyFiles","multi.cfg"); Path destination = Paths.get("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Medieval II Total War\\medieval2.preference.cfg"); Files.copy(origin, destination, REPLACE_EXISTING); } public void setSingleplayer() throws Exception{ Path origin = Paths.get(System.getProperty("user.home"), "Dropbox", "MTWMultiplayer","propertyFiles","single.cfg"); Path destination = Paths.get("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Medieval II Total War\\medieval2.preference.cfg"); Files.copy(origin, destination, REPLACE_EXISTING); }

以下是Apple文档中的示例代码。请注意,它首先从数据源中删除该项。然后执行- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;

试一试

deleteRowsAtIndexPaths: withRowAnimation: