Handle var=object for a to many relationship. Currently the code crashes. The fix causes it to import the single object into the relationship.
Changed to LLDB by Xcode Version 4.3 (4E109)
Fix to allow importing a single object into a to many relationship in…
…stead of crashing.
Can you give me an example of how this crashes? I'd ideally like to make a test case for this, but I'm also curious since this hasn't crashed here for me in a while...
Added functions to find objects by their objectID
Added a new pair of functions to fetch an object by it's NSManagedObjectID
Added error logging for functions.
Use a separate store coordinator for background threads. This will he…
…lp avoid lockups when resuming from local notifications.
Adding back in error logging for import.
Adding back in findWithObjectID
Fix crash on save during import.
Added helper function to obtain a permanent ID for an object that was…
… just inserted
Added some assert checking to give better indication as to why a fetc…
…h crashed. Now asserts at the point of breaking.
Merge branch 'master' of https://github.com/magicalpanda/MagicalRecord
Added functions to create an entity and obtain an permanent ID for it…
… at creation time. This is useful to create an object in a state ready to be modified by a save block.
Added several create and save and find/create functions.
Cleaned up createAndSaveEntityInContext where the localContext was sh…
…adowing the context.
Added MR_findFirstOrCreateByPredicate which is implemented with createAndSaveEntityInContext.
MR_findOrCreateByAttribute is now implemented in terms of findFirstOrCreateByPredicate.
Updated by Xcode
Fix main thread background save
Fix the crash on import properly by obtaining permanent IDs for the o…
…bjects added as relations.
Found out what the problem was. The key was in NSManagedObject+MagicalDataImport.m.
What was happening was if your data was complex enough and had enough nested objects you would end up with only some of the objects that were created being passed to obtainPermanentIDsForObjects:error: method.
These relationship entities did not have a permeant objectID which resulted in a crash on save when a save takes place on a child context.
This was not found by the test harness because it only tests MR_importFromObject. It never tests anything using MR_importFromArray: which uses -[MagicalRecord saveWithBlock:] which creates a child context.
The fix was to create an array that contains ALL the objects that were inserted. That array is then passed to obtainPermanentIDsForObjects:error: so that all the objects are given permanent IDs at one time. This also results in faster import because previously each imported object had a permanent ID assigned one at a time. This is a huge overhead for CoreData and was very slow. By passing all the objects in one call, the import time is much quicker than it previously was. An import of a complicated data file with many nested relationships 2 and 3 deep went from 9 seconds on device down to 3 seconds.
Revert "Fix the crash on import properly by obtaining permanent IDs f…
…or the objects added as relations."
This reverts commit d04770b.
Revert "Revert "Fix the crash on import properly by obtaining permane…
…nt IDs for the objects added as relations.""
This reverts commit 79167ae.
Methods to add multiple permanent objects at once.
I try to use [Program MR_importFromArray:responseObject inContext:[NSManagedObjectContext MR_defaultContext]]; and still crashing.
-NSManagedObjectContext(MagicalSaves) MR_saveWithErrorCallback: -> Saving : Context *** MAIN THREAD ***
Hi Brian, thanks for this information and apologies for not acting sooner on it. I believe that this is being addressed by #540, which will be in the next update.