简体   繁体   English

处于发布模式而非调试模式的应用程序的异常

[英]exception for app in release mode, not in debug mode

I'm having an exception in my didSelectRowAtIndexPath method and i'm not quite sure why. 我的didSelectRowAtIndexPath方法中有一个异常,我不太清楚为什么。 I'm showing the user a list of possibilities they can select from, the UITableView is populated based on values stored in Core Data. 我向用户显示了可供选择的可能性列表, UITableView基于存储在Core Data中的值进行填充。 The currently selected item has a Checkmark indicator. 当前选择的项目具有Checkmark指示符。 My method is below: 我的方法如下:

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    tableView.deselectRowAtIndexPath(indexPath, animated: true)

    let value = self.fetchedResultsController.objectAtIndexPath(indexPath) as CoreDataObject
    currentSelected = value.id as Int

    self.tableView.reloadData()
}

In development mode it's fine, but in production and testflight it crashes in this method. 在开发模式下可以,但是在生产和测试飞行中,此方法会崩溃。 The crash log is below: 崩溃日志如下:

Crashed Thread 0 :
0   CoreFoundation  0x25f41a7d  _CFRetain + 165
1   UIKit   0x29619d67  -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 919
2   UIKit   0x296cb9df  -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 195
3   UIKit   0x2957da25  _applyBlockToCFArrayCopiedToStack + 309
4   UIKit   0x294f982b  _afterCACommitHandler + 459
5   CoreFoundation  0x26007d95  __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21
6   CoreFoundation  0x26005453  __CFRunLoopDoObservers + 279
7   CoreFoundation  0x2600585b  __CFRunLoopRun + 915
8   CoreFoundation  0x25f533c1  CFRunLoopRunSpecific + 477
9   CoreFoundation  0x25f531d3  CFRunLoopRunInMode + 107
10  GraphicsServices    0x2d3510a9  GSEventRunModal + 137
11  UIKit   0x29562fa1  UIApplicationMain + 1441

Is there anything i'm missing here? 我在这里想念什么吗? Why is this method crashing? 为什么这种方法会崩溃? I'm simply storing the currently selected ID and then reloading data so that it can show a checkmark after the reload. 我只是存储当前选择的ID,然后重新加载数据,以便它在重新加载后可以显示选中标记。 Is there something i'm missing here? 我在这里想念什么吗? It should be as simple as just getting the new id and then reloading the data. 它应该像获取新ID然后重新加载数据一样简单。

The CoreDataObject that i'm using is from Objective-C and the id field is an NSNumber . 我正在使用的CoreDataObject来自Objective-C ,并且id字段是NSNumber

I tried other solutions below: 我在下面尝试了其他解决方案:

Crash when calling selectRowAtIndexPath:animated:scrollPosition: 调用selectRowAtIndexPath:animated:scrollPosition时崩溃:

iphone app crash at -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] iPhone应用程序在-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]崩溃

iOS - didSelectRowAtIndexPath causes crash in app iOS-didSelectRowAtIndexPath导致应用崩溃

In case anybody else has this issue. 万一其他人有这个问题。 currentSelected was a global variable declared as Int and the value object has an id field thats `NSNumber. currentSelected是一个声明为Int的全局变量,该value对象的id字段为NSNumber。 I changed it to the below and it works: 我将其更改为以下内容并起作用:

self.currentSelected = value.id.integerValue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM