Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MJExtension/MJFoundation.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ + (NSSet *)foundationClasses
[NSArray class],
[NSDictionary class],
[NSString class],
[NSAttributedString class], nil];
[NSAttributedString class],
[NSSet class],nil];
}
return foundationClasses_;
}
Expand Down
11 changes: 10 additions & 1 deletion MJExtension/NSObject+MJKeyValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ - (instancetype)mj_setKeyValues:(id)keyValues context:(NSManagedObjectContext *)
}

// 3.赋值

//赋值前先对CoreData进行处理
if ([context isKindOfClass:[NSManagedObjectContext class]] &&
propertyClass == [NSSet class] &&
[value isKindOfClass:[NSArray class]])
{
value = [[NSSet alloc] initWithArray:value];
}

[property setValue:value forObject:self];
} @catch (NSException *exception) {
MJExtensionBuildError([self class], exception.reason);
Expand Down Expand Up @@ -706,4 +715,4 @@ - (NSString *)JSONString
{
return [self mj_JSONString];
}
@end
@end