出现如下错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_PlayerControlsBar", referenced from:
objc-class-ref in PlayControl1.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
一般都是去Atarget -->Build Phases-->Complies Sources -->去看当前类的。m文件添加了没,或者少添加了什么类库
但有时会因为:
自己手写,或者复制别人代码时 在当前类的上面写个新类时,(由于疏忽)@interface 和@implementation有个少写 它也会报如上错误,原因你懂的
#import "PlayControl1.h"
#import "Button1.h"
@interface PlayerControlsBar : UIView
@property (nonatomic, strong) UIColor *color;
@end
//@implementation PlayerControlsBar
//
//@end
@implementation PlayControl1
{
Button1 *btn1;
Button1 *btn2;
Button1 *btn3;
Button1 *btn4;
Button1 *btn5;
PlayerControlsBar *_topBar;
PlayerControlsBar *_bottomBar;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super init];
if (self)
{
[self initWithUI];
}
return self;
}