remove quickly several managedObjectContext stored in a NSArray
for (NSManagedObject *toD开发者_JAVA百科elete in array) {
[moc deleteObject:toDelete];
}
is the first writting equivalent to the second one :
[array makeObjectsPerformSelector:@selector(deleteObject:) withObject:moc];
and if not, what would be the correct way for the second writting ?
Thanks
These are different statements. The latter is equivalent to this:
for (NSManagedObject *toDelete in array) {
[toDelete deleteObject:moc];
}
The former is correct and is generally what you should use.
精彩评论