1. 程式人生 > >iOS Undefined symbols for architecture i386:

iOS Undefined symbols for architecture i386:

 
 
出現如下錯誤:

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;

}