magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

Fix #1188 #1189

Closed gdunkle closed 5 years ago

gdunkle commented 8 years ago

Minor change to allow "Date" values that can't be parsed to continue on so that they can be handled by import functions.

Coeur commented 5 years ago

This change breaks the contract: the signature of the method says it returns an (NSDate *), so you can't return something else unless you change the signature, which has other problematic consequences.

Instead, you could do (in - (void)MR_setAttribute:(NSAttributeDescription *)attributeInfo withValueFromObject:(id)objectData):

id value = [attributeInfo MR_valueForKeyPath:lookupKeyPath fromObjectData:objectData] ?: [objectData valueForKeyPath:lookupKeyPath];

But there is a bit more to consider, like who has priority, MR_shouldUseDefaultValueIfNoValuePresent or MR_importValue:forKey:.