不知何故,我在 XCode 4.0.2 中遇到了这个错误,不知道出了什么问题。
文件:HomeViewController.h
#import <UIKit/UIKit.h>
@interface HomeViewController : UIViewController <UITabBarDelegate>
{
UIButton *Button1, *Button2, *Button3;
}
@property (nonatomic, retain) IBOutlet UIButton *Button1;
@property (nonatomic, retain) IBOutlet UIButton *Button2;
@property (nonatomic, retain) IBOutlet UIButton *Button3;
.... other member functions...
....
@end
文件:HomeViewController.m
......
#import "RemoteServiceManager.h"
@interface HomeViewController()
{ //This is where the error happens: Expected Identifier or "(" before "{" token
RemoteServiceManager* serviceManager;
}
@end
@implementation HomeViewController
@synthesize Button1, Button2, Button3;
.... other member functions
....
@end
看起来它无法识别 RemoteServiceManager。无论我在哪里使用 serviceManager,它都会说 HomeViewController 没有名为 serviceManager 的成员。
有可能是XCode版本引起的吗?我在 Mac OS X 10.6.7 上使用 XCode 4.0.2。
谢谢。