Dear all,
the following code block is never autocompleted by Xcode if I type
canDeleteManagedObject!?
What's wrong with it?
Xcode only shows
V BOOL (^)(NSManagedObject *) canDeleteManagedObject and completes
to canDeleteManagedObject.
Code:
BOOL (^canDeleteManagedObject)(NSManagedObject *) = ^ BOOL (NSManagedObject *object) {
///////////////////////////////////////////////////////////////////////////////////
// check if all Values are nil which aren't of attribute type NSStringAttributeType
///////////////////////////////////////////////////////////////////////////////////
__block int count = 0;
BOOL canDelete = NO;
[[object.entity attributesByName] enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if (((NSAttributeDescription *)obj).attributeType != NSStringAttributeType) {
count++;
if ([object valueForKey:key] == nil ) {
count--;
};
}
}];
if (count == 0) canDelete = YES;
return canDelete;
};