Just updated xcode to 4.5 and I’m receiving an error in one of my iOS apps which I wasn’t getting previously. Problem was not occurring before the update.
Basically, I have an array that needs sorting, based on some other irrelevant tests..
NSArray *sortedArray = [arrayFiles sortedArrayUsingComparator:^(id a, id b) {
NSString *first = [(PPFile*)a name];
NSString *second = [(PPFile*)b name];
if ([a isFileAvailableForRead] && ![b isFileAvailableForRead]) {
return NSOrderedAscending;
}else if(![a isFileAvailableForRead] && [b isFileAvailableForRead]) {
return NSOrderedDescending;
}
return [first compare:second];
}];
The error is on the last return of the block:
Return type 'NSComparisonResult' (aka 'enum NSComparisonResult') must match previous type 'NSInteger' (aka 'int') when block literal has unspecified explicit return type
Thanks.
You forgot the return value type: