We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- (BOOL)setPersistanceValue:(id)value forKey:(NSString *)key { BOOL result = YES; NSString *setter = [NSString stringWithFormat:@"set%@%@:", [[key substringToIndex:1] capitalizedString], [key substringFromIndex:1]]; if ([self respondsToSelector:NSSelectorFromString(setter)]) { if ([value isKindOfClass:[NSString class]]) { [self setValue:[value safeSQLDecode] forKey:key]; } else if ([value isKindOfClass:[NSNull class]]) { [self setValue:nil forKey:key]; } else { [self setValue:value forKey:key]; } } else { result = NO; } return result; }
在判断 [value isKindOfClass:[NSNull class]]分支里,value被设置为nil,导致crash
could not set nil as the value for the key
情景: 新建migratorStep,实现
- (void)goUpWithQueryCommand:(CTPersistanceQueryCommand *)queryCommand error:(NSError *__autoreleasing *)error { [[queryCommand addColumn:@"uploadFinishDate" columnInfo:@"INTEGER" tableName:@"LocalMovieTable"] executeWithError:error]; }
数据库中增加一个INTEGER类型的字段。数据库升级之后,由于新添字段,所以会走[value isKindOfClass:[NSNull class]]的分支,然而,这里uploadFinishDate并不是id类型,导致出错。
The text was updated successfully, but these errors were encountered:
这里我暂时的解决办法是把uploadFinishDate改成NSNumber类型
Sorry, something went wrong.
你原来的uploadFinishDate是什么类型?
发自我的 iPhone
如果是数字的内容,应该永远都使用NSNumber
原来的uploadFinishDate是unsigned long 类型
No branches or pull requests
在判断 [value isKindOfClass:[NSNull class]]分支里,value被设置为nil,导致crash
情景:
新建migratorStep,实现
数据库中增加一个INTEGER类型的字段。数据库升级之后,由于新添字段,所以会走[value isKindOfClass:[NSNull class]]的分支,然而,这里uploadFinishDate并不是id类型,导致出错。
The text was updated successfully, but these errors were encountered: