ios - Exec Bad Access on using MagicalRecord when saving objects -
When I save the objects, I have to face a problem using the magical record.
save reference using this:
- (minus) saveContext {[NSManagedObjectContext defaultContext] saveToPersistentStorewithCompletion: ^ (BOOL success, NSError * error) {if (success) {NSLog (@ "You successfully saved your reference."); } And if (error) {NSLog (@ "Error saving reference:% @", error description); }}]; } For this reason crashes my app [EXC_BAD_ACCESS] on the [[self MR_defaultContext] mergeChangesFromContextDidSaveNotification: Information] ; I have used other methods:
// index the correct order based on the order * orderToComplete = [self Vshuvistaranurupon: Suckankkpat .]; // set the order after completion [Magic recorded Sevvithblok: ^ (Ansmanedobjekttontekst * Sthaniycontekst) (Order * Local orders = [Order to Conteksः local Contaks] The compound [local order sets IS contained price: Yes];} Conclusion: ^ (the success of Bell, Ansiarar * error) {if (success) Anselog (@ "you have successfully saved your reference."); other NSLog (@ "error saving reference:% @", error.description);}] ; but still crashes randomly.
My app is not a multithreaded app. Here's a shot:
Do anyone have any ideas?
I can fix my problem but could not get the exact reason.
You should follow
- All in the target method Clean the code and just create an object and save it? If so:
- your code and step-by-step test by adding it where you code that you can find, manage Objektstor be in an inconsistent state. For me this representative representative was due to call. I have put
[NSManagedObjectContext saveContext] after the representative method calling it I am using version 2.2, I know where the problem is But I was not able to understand! But here I am: A new item will be pushed from the network to the device, so if it is the first record then the cell should be automatically selected so I call the details. View Controller Representative Setup to update your item after that KVO will notify changes and try to update the table: there is no record, a new item will be pushed to the device and its sub Ms will be added to the description Drishykantrolr through a representative method
Self. SubItems = subItems;
Step: 1- View Update 2 - reference save
delegate method no evidence Kevio first notice in the second blast after the call twice every push change value of Kevio notice changes in sub Anske setting second blast If there is, there is an inclusion in the colonies in the item, as I said that the representative method calls twice, Changes in Io notice NSKeyValueChangeSetting. After reloading table app accidents on this move!
NSNumber * type = [Change object reordering: NSKeyValueChangeKindKey]; // if we are setting new items for item array; This means that when we select a new line (if the [type of integer value] == NSKeyValueChangeSetting) {// NSArray to add new items to the top of the table * newItems = [change valueForKey: @ "new"]; [Self.tableViewReloadData]; } // If we're adding a new order for the order Arare If ([type integer value] == NSKeyValueChangeInsertion) to add a new order at the top of {// table view [self.tableView insertSections: [NSIndexSet IndexSetWithIndex: 0] WithRowAnimation: UITableViewRowAnimationTop]; } Finally, I tried to call once the caller to solve this accident but I could not understand why the above error is!
Comments
Post a Comment