Я пытаюсь импортировать более 7000 контактов в CoreData через,
сейчас я пытаюсь использовать поток, но приложение вылетает
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"threadSendToBackground");
for (NSDictionary *contactDetail in [[xmlDictionary valueForKey:@"response"] valueForKey:@"entry"]) {
Contacts *AddCDContacts = (Contacts *)[NSEntityDescription insertNewObjectForEntityForName:@"Contacts" inManagedObjectContext:appDelegate.managedObjectContext];
[AddCDContacts setDisplayName:[contactDetail valueForKey:@"displayName"]];
NSError *error;
if (appDelegate.managedObjectContext != nil) {
if ([appDelegate.managedObjectContext hasChanges] && ![appDelegate.managedObjectContext save:&error]) {
// Handle the error.
NSLog(@"Error saving");
}
}
}
[pool release];