【发布时间】:2009-11-19 22:05:17
【问题描述】:
我正在尝试为 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 吗?我看不出我应该收到此错误的任何充分理由。
标签: iphone xcode compiler-errors mapkit