ios - 使用委托(delegate)时 SIGSEGV 崩溃

标签 ios objective-c segmentation-fault

我不断收到此崩溃报告,但我无法弄清楚问题出在哪里。我了解 SIGSEGV异常类型通常是由于内存管理问题。

崩溃日志,

zException Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0x10
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                     0x394db0fc objc_retain + 12
1   Sparkle                             0x0012c9d7 -[PhotoAssetView didSelectButton:] (PhotoAssetView.m:44)
2   UIKit                               0x3193ada3 -[UIApplication sendAction:to:from:forEvent:] + 91
3   UIKit                               0x3193ad3f -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 39
4   UIKit                               0x3193ad13 -[UIControl sendAction:to:forEvent:] + 47
5   UIKit                               0x31926743 -[UIControl _sendActionsForEvents:withEvent:] + 375
6   UIKit                               0x3193a75b -[UIControl touchesEnded:withEvent:] + 595
7   UIKit                               0x318fe1a1 _UIGestureRecognizerUpdate + 5529
8   UIKit                               0x319359fd -[UIWindow _sendGesturesForEvent:] + 773
9   UIKit                               0x319353ab -[UIWindow sendEvent:] + 667
10  UIKit                               0x3190ad79 -[UIApplication sendEvent:] + 197
11  UIKit                               0x31909569 _UIApplicationHandleEventQueue + 7117
12  CoreFoundation                      0x2f14cf1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13  CoreFoundation                      0x2f14c3e7 __CFRunLoopDoSources0 + 207
14  CoreFoundation                      0x2f14abd7 __CFRunLoopRun + 631
15  CoreFoundation                      0x2f0b5471 CFRunLoopRunSpecific + 525
16  CoreFoundation                      0x2f0b5253 CFRunLoopRunInMode + 107
17  GraphicsServices                    0x33def2eb GSEventRunModal + 139
18  UIKit                               0x3196a845 UIApplicationMain + 1137
19  Sparkle                             0x0040a427 main (main.m:18)

这个方法里面[PhotoAssetView didSelectButton:]我们使用 unsafe_unretained delegate 调用了一种方法,
[self.delegate didSelectButtonForPhotoAsset:sender];

任何指针?

最佳答案

你对其他地方的代表有强烈的引用吗?通常设置一个对象的委托(delegate)不会创建一个强引用,所以如果你自己不保留一个,它将在它被调用之前被释放,你会像这样崩溃。

关于ios - 使用委托(delegate)时 SIGSEGV 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21546616/

相关文章:

ios - Parse.com 和 AFNetworking 2.0 日期查询

ios - 检测一个点是否在 iPhone sdk ios 7 中的 MKCircle 内部

ios - 如何使用完成按钮将数据从 View 传回选项卡栏 Controller 中的 View

ios - 从另一个线程更改按钮图标/切换按钮

javascript - 使用 Cordova Webview/Phonegap 按钮 onclick 更改 native View (事件监听器)

c - 需要帮助弄清楚为什么 strtok 导致段错误,它不能使用 const char* 参数吗?

ios - 如何使用共享初始化方法初始化 let 变量?

ios - 总是将 self 的弱引用传递到 ARC 中的 block 中?

c - 比较 C 中两个字符串的问题(段错误)核心转储

c++ - 如何在不记录核心转储或错误的情况下调试意外进程终止