我试图创造MKAnnotationView的一个iPhone应用程序Mapkit一个子类,但由于某些原因,我突然遇到这个错误:在MKAnnotationView的子类中导致这个错误的原因是什么?
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
这是我的头和主文件似乎代码导致错误。尽管该错误没有针对该文件特别显示,但如果我将.m文件从@implementation注释到@end,则不会出现该错误。但是,如果我在实现中评论所有内容(不包括@implementation本身),它仍会出现。
PhotoAnnotationView.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface PhotoAnnotationView : MKAnnotationView {
UIImageView *thumb;
}
@property (nonatomic, retain) IBOutlet UIImageView *thumb;
@end
PhotoAnnotationView.m
#import "PhotoAnnotationView.h"
@implementation PhotoAnnotationView
@synthesize thumb;
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)drawRect:(CGRect)rect {
// Drawing code
}
- (void)dealloc {
[super dealloc];
}
@end
这基本上是通过Xcode中与New File... > Objective-C Class > Subclass of: UIView
子类改变创建的相同的代码。
我在Snow Leopard上运行的Xcode 3.2.1版本。
我应该尝试重新安装的Xcode?我没有看到有什么好的理由说明我为什么应该得到这个错误。 – 2009-11-22 04:30:18