UA-17470720-3

Jump to content


Photo
- - - - -

Core Data, persisting new objects


  • Please log in to reply
24 replies to this topic

#21 Tommy Wild

Tommy Wild

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 175 posts
Reputation: 12
Good

Posted 11 October 2010 - 04:50 AM

I just did a little more testing with my application.

In my ViewDidLoad of the Progress view controller, I added the code below and it saved fine. I'm not sure why STV's inserts aren't saving.

At the moment, my ProgressData entity only has "caption" and "dateAdded"
attributes.


ProgressData *data = [NSEntityDescription insertNewObjectForEntityForName:@"ProgressData" inManagedObjectContext:managedObjectContext_];
	
	data.caption = @"Hello";
	
	
	NSError *error = nil;
	if (![self.managedObjectContext save:&error]) {
		/*
		 Replace this implementation with code to handle the error appropriately.
		 
		 abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
		 */
		NSLog(@"[ProgressVC tableViewModel:didInsertRowAtIndexPath] - Unresolved error %@, %@", error, [error userInfo]);
		abort();
	}





#22 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 11 October 2010 - 05:08 AM

I have finally been able to replicate you issue Tommy :)

We will need to fix a minor issue with STV's architecture to enable saving the managedObjectContext right after the row has been added. The fix will be available in 2 or 3 days, just in time for our new 1.6 release. Thank you so much for all your feedback!

#23 Tommy Wild

Tommy Wild

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 175 posts
Reputation: 12
Good

Posted 11 October 2010 - 05:17 AM

That is great news Tarek!

Thanks for making a GREAT product better.

#24 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 October 2010 - 07:38 AM

Hi Tommy,

Please confirm that this is now working with our new 1.6 release. Thanks!

#25 Tommy Wild

Tommy Wild

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 175 posts
Reputation: 12
Good

Posted 15 October 2010 - 09:44 AM

Yes, this works great now, thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users