Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS error when opening a record that is created #6

Open
hugomelis opened this issue Nov 24, 2012 · 2 comments
Open

EXC_BAD_ACCESS error when opening a record that is created #6

hugomelis opened this issue Nov 24, 2012 · 2 comments
Labels

Comments

@hugomelis
Copy link

In the example app I get the following EXC_BAD_ACCESS error when I have created a person. You can reproduce it by creating a new person after logging in. After that you directly try to edit this record by clicking on it. The error is produced because the record is not yet inserted (as far as I can tell). After restarting the app (and probably trigger something that actually saves the record) the person can be clicked and therefore edited.
The method that triggers the EXC_BAD_ACCESS is: updateInterfaceForCurrentPerson

In the debugger a PO of self.person shows this:
(Person *) $1 = 0x07a2ffa0 <Person: 0x7a2ffa0> (entity: CDPerson; id: 0x9055ee0 x-coredata://05BD5986-FA3C-4F0D-9025-4A34FB52291D/CDPerson/tE9FFF278-49AE-4C11-8BE6-B29EC909B1A02 ; data: )

After a restart a PO of self.person shows this:
(Person *) $1 = 0x0f691360 <Person: 0xf691360> (entity: CDPerson; id: 0x7d9b8a0 x-coredata://05BD5986-FA3C-4F0D-9025-4A34FB52291D/CDPerson/p2 ; data: )

@hugomelis
Copy link
Author

I found the solution to this, the MagicalRecord supplied with the example is outdated. I updated the version with the current one and after changing 3 calls to method in FTASyncHandler.m:
[[NSManagedObjectContext MR_contextForCurrentThread] MR_saveErrorHandler:^(NSError *error){
into:
[[NSManagedObjectContext MR_contextForCurrentThread] MR_saveWithErrorCallback:^(NSError *error){
all was working correctly in the example!

@itsniper
Copy link
Owner

Glad you got it working! It looks like you were getting temporary object IDs, which was fixed in Magical Record here: magicalpanda/MagicalRecord@0b00e39

It looks like Magical Record recently removed the MR_saveErrorHandler: method (magicalpanda/MagicalRecord@f7c4350) so FTASync needs updated to account for that.

inturbidus pushed a commit to inturbidus/FTASync that referenced this issue Jul 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants