Xcode 5.1.1: Core Data NSManagedObjectContext setPrimitiveValue:forKey:
| Originator: | rwgrier | ||
| Number: | rdar://17268938 | Date Originated: | 11-Jun-2014 11:04 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 5.1.1 (5B1008) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: Ran across a bug yesterday where data was being written to the wrong property in our Core Data store. Turned out to be a typo with the one of the keys we were using to save data. I found this in the docs: “Primitive accessor methods are only supported on modeled properties. If you invoke a primitive accessor on an unmodeled property, it will instead operate upon a random modeled property. (The debug libraries and frameworks from (available from the Apple Developer Website) have assertions to test for passing unmodeled keys to these methods.)” Seems inconsistent from other Apple APIs which would return an error, or trigger an assertion or give some sort of immediate feedback. Writing data to a random modeled property seems odd. Steps to Reproduce: Have a typo in one of the keys used when calling setPrimitiveValue:forKey: It will eventually start writing over stuff you care about. Expected Results: I’d expect some sort of assertion telling me that I did something stupid and that property is not a modeled property. Even a warning would be nice. Actual Results: Data was written to a random property. This was fun to track down. Regression: Noticed this in iOS 7 Notes:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!