Open levicc opened 6 years ago
NSDate *date = [NSDate date]; Employee *employee = [[Employee alloc] initWithId:2 name:@"New Emp2" dateOfBirth:date department:nil]; [employee save];
像例子那样,存的 department 为 nil,之后取出来会在 300 行处崩溃:
//GYDBRunner.m if (propertyClass && value) { //这边加个判断才行 id cache = [_cacheDelegate objectOfClass:propertyClass id:value]; if (!cache) { cache = [[(Class)propertyClass alloc] init]; **[cache setValue:value forKey:[propertyClass primaryKey]];** [cache setValue:@YES forKey:@"fault"]; [_cacheDelegate cacheObject:cache]; } value = cache; }
按理说肯定会考虑过这个问题,是我的姿势有问题吗?
像例子那样,存的 department 为 nil,之后取出来会在 300 行处崩溃:
按理说肯定会考虑过这个问题,是我的姿势有问题吗?