【发布时间】:2018-10-23 17:47:39
【问题描述】:
我的代码是这样的:
Member *member = [Member new];
__weak __typeof(self) weakSelf = self
member.gotoPageBlock = ^(NSString *url) {
__strong __typeof(weakSelf) self = weakSelf
[self goToPageWithURL:[NSURL URLWithString:url]];
};
它很少会崩溃,这个崩溃的顶部堆栈是这样的:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x365722298
Triggered by Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000182794bb4 _objc_loadWeakRetained :156 (in libobjc.A.dylib)
执行块时发生崩溃。
有谁知道发生了什么?
【问题讨论】:
-
代码没有问题。问题一定出在其他地方。
标签: objective-c automatic-ref-counting block