背景描述
#import "TMUStoreMemoryDataCache.h"
static TMUStoreMemoryDataCache * _instance = nil;
@implementation TMUStoreMemoryDataCache
+ (instancetype)shareInstance{
//static TMUStoreMemoryDataCache * instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[TMUStoreMemoryDataCache alloc]init];
});
return _instance;
}
我在一下代码中创建的单例,使用全局的static _instacce,就会出现以下错误,这个断点即使不打开
All Exceptions`也会出现。后来我将上面全局的变量改成局部的,就不在出错。问题原因尚未找到
Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x101c2f740). The process has been returned to the state before expression evaluation.
解决
将全局_instace
换成局部的instace
,就能解决
原因
还未找到具体原因