アプリを閉じたときに情報を保存する方法。再度開くたびに、すべてのコアデータが消去されるためです。
次に例を示します。
NSString *nomville = [[_jsonDict objectAtIndex:indexPath.row] objectForKey:@"label"];
NSString *idVille = [[_jsonDict objectAtIndex:indexPath.row] objectForKey:@"id"];
detailView.title = nomville;
detailView.idVille = idVille;
NSLog(@"Valor: %@", nomville);
NSLog(@"Valor: %@", idVille);
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSManagedObject *villesR = [NSEntityDescription
insertNewObjectForEntityForName:@"Ville"
inManagedObjectContext:context];
[villesR setValue:idVille forKey:@"idV"];
[villesR setValue:nomville forKey:@"nom"];
[self.navigationController pushViewController:detailView animated:YES];