简体   繁体   中英

Apple-Mach-O Linker Error UIKit iOS 8

I am a little lost as to why I am getting this error. Pretty much, I am abstracting some code to make a helper class that lets me reuse colors I use through out my app. The reason I don't understand why I am getting this error is because when I import my class to my NC Widget, no complaints. However, when I import my class to my TableViewController that is the base for my tableviews in my app, I get this error. UIKit is added to my frameworks, so I am not sure what I am doing wrong.

#import <UIKit/UIKit.h>

@interface ColorPalette : UIColor

+(UIColor *)setColorRed;
+(UIColor *)setColorBlue;
+(UIColor *)setColorGreen;
+(UIColor *)setColorOrange;


@end

And

#import "ColorPalette.h"

@implementation ColorPalette

+(UIColor *)setColorRed{
    return [UIColor colorWithRed:204/255.0f green:25/255.0f blue:36/255.0f alpha:1.0f];
}

+(UIColor *)setColorGreen{
    return [UIColor colorWithRed:29/255.0f green:156/255.0f blue:48/255.0f alpha:1.0f];
}

+(UIColor *)setColorBlue{
    return [UIColor colorWithRed:67/255.0f green:174/255.0f blue:249/255.0f alpha:1.0f];
}

+(UIColor *)setColorOrange{
    return [UIColor colorWithRed:237/255.0f green:145/255.0f blue:50/255.0f alpha:1.0f];
}


@end

So when I import it to my table view:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ColorPalette", referenced from:
      objc-class-ref in TableView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Top of .m TableView File

#import "TableView.h"
#import "ColorPalette.h"

Top of .h TableViewFile

#import <UIKit/UIKit.h>

@interface TableView : UIViewController <UITableViewDataSource, UITableViewDelegate>

确保您的Tableview.m文件在“目标”->“构建阶段”->“编译源”下列出。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM