I have the following code in an .mm file:
[UIView animateWithDuration:0.3 animations:^{
self.titleLabel.alpha = 0.0;
} completion:^(BOOL finished) { //<<compiler complains here
self.titleLabel.alpha = 1.0;
}];
But I get the compiler error:
Cannot initialize a parameter of type ‘void (^)(BOOL)’ with an rvalue of type ‘void (^)(int)’
on the line mentioned above. The code is fine in a normal .m file. Am I doing something wrong, or is there a problem with the compiler?
UPDATE: Header imports are:
#import <UIKit/UIKit.h>
and .mm imports are (censored):
#import "XXSelectViewController.h"
#import "XXViewController.h"
#import "AboutViewController.h"
#import "HighScoresViewController.h"
#import "GameModel.h"
UPDATE 2: Also, I get a warning on this line:
- (void)viewDidDisappear:(BOOL)animated
warning:
Conflicting parameter types in implementation of ‘viewDidDisappear:’: ‘BOOL’ (aka ‘signed char’) vs ‘int’
We are using the PowerVR tools in this project, and in PVRShell.h and PVRTResourceFile.h are the following lines:
typedef bool (*PFNReleaseFileFunc)(void* handle);
typedef bool (*PFNReleaseFileFunc)(void* handle);
I don’t know if this has anything to do with the issues though…
It turns out the reason for the errors is because of this line, buried deep within the PVR Tools:
So there’s a macro going through all of the code, replacing
BOOLwithint. Not ideal! I think the reason it’s causing a problem is because the tools were added as a folder and not as an embedded .xcodeproj … So we may need to re-import it. Lesson learned!Bizarrely though, if I comment out that line, the code still works 😉 but who knows for how long!