我在.mm文件中有以下代码:
[UIView animateWithDuration:0.3 animations:^{
self.titleLabel.alpha = 0.0;
} completion:^(BOOL finished) { //<<compiler complains here
self.titleLabel.alpha = 1.0;
}];
但是我得到了编译器错误:
在上面提到的线上。该代码在普通的.m文件中很好。我是在做错什么,还是编译器有问题?
更新: header 导入为:
#import <UIKit/UIKit.h>
和.mm导入(已审查):
#import "XXSelectViewController.h"
#import "XXViewController.h"
#import "AboutViewController.h"
#import "HighScoresViewController.h"
#import "GameModel.h"
更新2:此外,我在此行收到警告:
- (void)viewDidDisappear:(BOOL)animated
警告:
我们在该项目中使用PowerVR工具,在PVRShell.h和PVRTResourceFile.h中包含以下几行:
typedef bool (*PFNReleaseFileFunc)(void* handle);
typedef bool (*PFNReleaseFileFunc)(void* handle);
我不知道这是否与问题有关...
最佳答案
事实证明,错误的原因是因为这条线埋在PVR工具的深处:
#define BOOL int
因此,存在一个遍历所有代码的宏,将
BOOL
替换为int
。不理想!我认为它引起问题的原因是因为这些工具是作为文件夹而不是作为嵌入式.xcodeproj添加的。因此,我们可能需要重新导入它。学过的知识!但是奇怪的是,如果我注释掉那行,代码仍然可以工作;)但是谁知道能持续多久呢!