This is the point at which we caught the crash. "sigtramp" is the signal "trampoline." That's a fancy way of saying "I caught a signal (crash) and now I'm going to bounce to somewhere else in the code."

 

MJCache

这里崩溃了,

@implementation MJDictionaryCache
+ (id)setObject:(id)object forKey:(id<NSCopying>)key forDictId:(const void *)dictId
{
    // 获得字典
    NSMutableDictionary *dict = [self dictWithDictId:dictId];
    if (dict == nil) {
        dict = [NSMutableDictionary dictionary];
        objc_setAssociatedObject(self, dictId, dict, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    
    // 存储数据
    dict[key] = object;
    
    return dict;
}

+ (id)objectForKey:(id<NSCopying>)key forDictId:(const void *)dictId
{
    return [self dictWithDictId:dictId][key];
}

+ (id)dictWithDictId:(const void *)dictId
{
    return objc_getAssociatedObject(self, dictId); // here we crash 
}

  

1.分析,这个是不是线程安全的?是不是有删除了? ---- NSMutableArray 并非线程安全的

2. 如果cache 获取的值为nil, nil[key]这样调用会crash。

3. key 也可能是空。