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

How to manually call the save method? #101

Closed
foxling opened this issue Dec 31, 2014 · 13 comments
Closed

How to manually call the save method? #101

foxling opened this issue Dec 31, 2014 · 13 comments
Assignees
Milestone

Comments

@foxling
Copy link
Contributor

foxling commented Dec 31, 2014

I found that when i call model.save() or model.endWriting(), they are not save to database.
Sometimes , I want to manually call the save method to save data immediately in database.
like:

[MagicalRecord saveUsingCurrentThreadContextWithBlockAndWait:nil];
@pepicrft
Copy link

@foxling are you using CoreData?

@foxling
Copy link
Contributor Author

foxling commented Jan 1, 2015

@pepibumur yes

@pepicrft
Copy link

pepicrft commented Jan 1, 2015

Are you enabling the autosaving value of DefaultCoreDataStack @foxling ?

@foxling
Copy link
Contributor Author

foxling commented Jan 1, 2015

@pepibumur DefaultCDStack.startObserving() is only call in DefaultCDStack.backgroundContext(), but i'm not use backgroundContext, so the mergeChanges method is never called, the autosaving is not useful.

@pepicrft
Copy link

pepicrft commented Jan 1, 2015

Why aren't you using the background context? The stack is setup to connect those context with the saving behaviour. @foxling

@deivuh
Copy link

deivuh commented Jan 1, 2015

I'm also having this issue.

The autosaving value of DefaultCoreDataStack is enabled, but it won't write to the database after calling the save() method of a model. But if I send the app to the background (pressing the home button) it does write the data which I believe it's done by the SugarRecord.applicationWillEnterForeground() method.

@pepicrft
Copy link

pepicrft commented Jan 1, 2015

Checked with the example project ant yes, there's a regression there @foxling and @deivuh , assigning a high priority to work on that as soon as possible. Thanks for the report guys

@pepicrft
Copy link

pepicrft commented Jan 2, 2015

Solved @deivuh and @foxling

@deivuh
Copy link

deivuh commented Jan 3, 2015

Thanks @pepibumur ! Really appreciate it

@foxling
Copy link
Contributor Author

foxling commented Jan 3, 2015

Thanks @pepibumur

@thewhitewood
Copy link

Had the same issue - pulled the latest/ fix off the repo and it's missing "SugarRecordArray" ?

@pepicrft
Copy link

pepicrft commented Jan 7, 2015

@thewhitewood remove the group from XCode and add the entire library again because you're missing a new class I added to the library but that you haven't added to the XCode target as a file to be compiled.

@thewhitewood
Copy link

Cool - my bad :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants