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:
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
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)