我正在尝试使用以下代码用 NSFetchRequest 填充具有 2 个实体的表视图:
@property (strong) NSMutableArray *forms;
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"names"];
NSFetchRequest *fetchRequest2 = [[NSFetchRequest alloc] initWithEntityName:@"forms"];
self.forms = [[managedObjectContext executeFetchRequest:fetchRequest error:nil] mutableCopy];
self.forms = [[managedObjectContext executeFetchRequest:fetchRequest2 error:nil] mutableCopy];
[self.tableView reloadData];
现在我知道 self.forms 被第二次提取覆盖了,但我不知道如何完成将所有内容放入 self.forms 数组