Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-08-2011, 09:22 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Baton Rouge, LA
Posts: 131
j3rm is on a distinguished road
Default CoreData:User creates new record, but then cancels = trash.. thoughts...

Hi all,
I need some feedback on something I would like to improve in my apps.
I have several Business apps, and they use CoreData. When a user wants to add a new record, I create one and save it to the database, then show the ViewController to edit the record. The side affect of this approach is that , if the user cancels, then there is a "half baked" record hanging out there, that shows up and confuses the user.

Ideally, I would like for the record to no longer exist if the user hits cancel.
I have some ideas but I don't think they are good solutions, as they open the door for more bugs. Whats the right way to do this?

I appreciate any insight.
Thanks
j3rm is offline   Reply With Quote
Old 09-08-2011, 10:47 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Solution I haven't tried yet: specify nil for the context when creating the object. Insert it into the context when the user saves.

Solution I have done: create a placeholder instance, with some kind of flag that keeps it out of regular usage. The edit screen deals with this instance. When the user saves, create a new instance and copy over the necessary properties from the placeholder.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Tags
cancel, coredata, new record

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 383
8 members and 375 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, UMAD, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,904
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:55 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0