Skip to content

Commit

Permalink
修复当EntityName和ClassName不一致时Crash. (#718)
Browse files Browse the repository at this point in the history
* 修复当EntityName和ClassName不一致时Crash.

Co-authored-by: ligang <[email protected]>
Co-authored-by: Frank <[email protected]>
  • Loading branch information
3 people authored Sep 8, 2021
1 parent e3799cb commit 7eb9913
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MJExtension/NSObject+MJKeyValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ + (instancetype)mj_objectWithKeyValues:(id)keyValues context:(NSManagedObjectCon
MJExtensionAssertError([keyValues isKindOfClass:[NSDictionary class]], nil, [self class], @"keyValues参数不是一个字典");

if ([self isSubclassOfClass:[NSManagedObject class]] && context) {
NSString *entityName = [NSStringFromClass(self) componentsSeparatedByString:@"."].lastObject;
NSString *entityName = [(NSManagedObject *)self entity].name;
return [[NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context] mj_setKeyValues:keyValues context:context];
}
return [[[self alloc] init] mj_setKeyValues:keyValues];
Expand Down

0 comments on commit 7eb9913

Please sign in to comment.