I have a dictionary and I am trying to load all of its data into Core Data.
However, it is inserting only the last element into Core Data.
NSArray *NameArray = [resultsDictionary objectForKey:@"Sections"];
for (NSDictionary *Dictionary in NameArray) {
[section setValue:[Dictionary objectForKey:@"Name"] forKey:@"name"];
}
You override the value for “name” key in every iteration. Thats why only last one gets saved. You should insert a new object or update existing one for every dictionary item.