如何使用UIViewController创建子类UIViewControllerDebug?

时间:2012-03-10 07:19:26

标签: objective-c xcode

我用超类UIController创建了一个自定义超类UIControllerDebug。

我将这个类与其他一些子类一起使用。它崩溃了:

Undefined symbols for architecture i386:
  "_OBJC_METACLASS_$_UIViewControllerDebug", referenced from:
      _OBJC_METACLASS_$_Main in Main.o
  "_OBJC_CLASS_$_UIViewControllerDebug", referenced from:
      _OBJC_CLASS_$_Main in Main.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
什么是haapened?

代码在这里: .H

#import <UIKit/UIKit.h>
@interface UIViewControllerDebug : UIViewController
@end

的.m

#import "UIViewControllerDebug.h"
@implementation UIViewControllerDebug
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    Output(@"[v]%@ touchesBegan",NSStringFromClass([self class]));
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    Output(@"[v]%@ touchesBegan",NSStringFromClass([self class]));
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    Output(@"[v]%@ touchesBegan",NSStringFromClass([self class]));
}
@end

1 个答案:

答案 0 :(得分:0)

您的源代码中没有@implementation UIViewControllerDebug,或者“编译源”中未列出包含@implementation UIViewControllerDebug的文件目标的“构建阶段”选项卡部分。