Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Problem with objective-c troubleShooting

Hi there,
i'm all new to mac & iOS developement and am getting startet by working throught what appeared to be a great book "Einstieg in Objective-C 2.0 and Cocoa inkl iPhone programming".

what im doing right now is creating an Weblog App for the iPhone by following stepBy step coding and interface instructions by this book.

problem: everything seems to work just fine, i can compile and everything. but one funktion does not work which is creating a new article.

the errorcode looks like that:

+2011-01-25 14:59:28.775 WeblogClientTouch[12682:207] Fehler beim Anlegen eines neuen Artikels+

and is produced by an NSLog:

if (![managedObjectContext save:&error]) {
NSLog(@"Fehler beim Anlegen eines neuen Artikels");
}

so apparently the saving of a new entity 'article' does not work. here some code snippets that might help, first the function that creates a new article in which the error occurs:


- (IBAction)neuerArtikel
{
//erzeuge artikel
NSEntityDescription *artikelDescription = [[fetchedResultsController fetchRequest]entity];
NSManagedObject *newArtikel = [NSEntityDescription insertNewObjectForEntityForName:[artikelDescription name]
inManagedObjectContext:managedObjectContext];

//befülle artikel mit standardwerten
[newArtikel setValue:NSLocalizedString(@"Neuer Artikel", nil)
forKey:@"titel"];
[newArtikel setValue:[NSDate date] forKey:@"datum"];
[newArtikel setValue:@"Markus" forKey:@"autor"];

//speichere artikel
NSError *error;

if (![managedObjectContext save:&error]) {
NSLog(@"Fehler beim Anlegen eines neuen Artikels");
}

//Tableview aktualisieren
[self.tableView reloadData];
}


in my datamodel i have only one entity named "Artikel" with the attributes: autor, titel, datum, inhalt.


i would be very glad about some tips, because i've been trying to solve the problem for nearly 3 hours now and i dont think it can be that tricky..

Message was edited by: sfluecki

Message was edited by: sfluecki

macbook pro, Mac OS X (10.6.6)

Posted on Jan 25, 2011 6:17 AM

Reply
16 replies

Problem with objective-c troubleShooting

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.