How to Perform a Lightweight Core Data Migration
5 posts
• Page 1 of 1
How to Perform a Lightweight Core Data Migration
This is the official thread to discuss the following blog post: How to Perform a Lightweight Core Data Migration
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

rwenderlich - Site Admin
- Posts: 1776
- Joined: Thu Dec 23, 2010 4:14 pm
- Has thanked: 26 times
- Been thanked: 186 times
Re: How to Perform a Lightweight Core Data Migration
Thanks for the great tutorial Scott. I have one question. Can you explain why you decided to pass in an NSManagedObject to the DetailViewController instead of an NSManagedObjectContext when creating a new Thought? I understand that passing the managed object requires to implement a rollback functionality as you mentioned if the users cancels, but wouldn't be more efficient to have DetailViewController create the managed object and save it only when the user taps a save button? If not, how would one go about implementing the rollback functionality?
Re: How to Perform a Lightweight Core Data Migration
@alnp1987 Thanks, glad you liked it! You could delay creating a new managed object until when Save is tapped. This would involve caching the data, e.g., in a dictionary in the create/edit view controller, and then accessing that dictionary in a delegate in a method such as someDetailViewControllerDidFinish, where you would proceed with creating a new managed object and assigning the values. To implement rollback, you would first create and set an undo manager on your managed object context when you instantiate it, and then to rollback, just call rollback on your managed object context in your delegate in a method such as someDetailViewControllerDidCancel. These are great questions, which do go beyond the scope of this tutorial, though. Hopefully my brief comments help to steer you in the right direction. Good luck!
-

scotteg - iOS Tutorial Team Member
- Posts: 14
- Joined: Sun May 01, 2011 11:15 pm
- Location: Greater St. Louis area
- Has thanked: 3 times
- Been thanked: 1 time
Re: How to Perform a Lightweight Core Data Migration
Great Tutorial especially the explanation.
I have a business app and I am using iCloud which is working fine. However, lightweight migration and iCloud don't seem to want to play together. Your thoughts?
Thanks
John
I have a business app and I am using iCloud which is working fine. However, lightweight migration and iCloud don't seem to want to play together. Your thoughts?
Thanks
John
- johnheb
- Baby Hacker
- Posts: 7
- Joined: Mon Oct 08, 2012 12:07 pm
- Has thanked: 1 time
- Been thanked: 1 time
Re: How to Perform a Lightweight Core Data Migration
@johnheb Thanks! I haven't done anything with iCloud in a while. What I have been meaning to do though is check out StackMob's service, which is integrated with Core Data. What sort of issues are you having with using Core Data and iCloud after doing a migration? Also, have you filed a radar with Apple?
-

scotteg - iOS Tutorial Team Member
- Posts: 14
- Joined: Sun May 01, 2011 11:15 pm
- Location: Greater St. Louis area
- Has thanked: 3 times
- Been thanked: 1 time
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests