Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 体系结构i386的未索引符号:链接器错误_Objective C_Xcode4.2 - Fatal编程技术网

Objective c 体系结构i386的未索引符号:链接器错误

Objective c 体系结构i386的未索引符号:链接器错误,objective-c,xcode4.2,Objective C,Xcode4.2,编译时,我收到2个错误 架构i386的未定义符号: “\u IKImageBrowserNSURLRepresentationType”,引用自: -ATDesktopEntity.o中的[ATDesktopEntity imageRepresentationType] “.objc\u class\u name\u CABasicAnimation”,引用自: 指向ATColorView.o中文本objc类名的指针 ld:未找到架构i386的符号 叮当声:错误:链接器命令失败,退出代码为1(使

编译时,我收到2个错误

架构i386的未定义符号:

“\u IKImageBrowserNSURLRepresentationType”,引用自:

-ATDesktopEntity.o中的[ATDesktopEntity imageRepresentationType]

“.objc\u class\u name\u CABasicAnimation”,引用自: 指向ATColorView.o中文本objc类名的指针 ld:未找到架构i386的符号 叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)

我已经包括了2个实现文件,我觉得问题正在发生

#import "ATDesktopEntity.h"
#import <Quartz/Quartz.h>

#define THUMBNAIL_HIEGHT 180.0
#define DEMO_MODE 0

@implementation ATDesktopEntity

+ (ATDesktopEntity *)entityForURL:(NSURL *)url {

    NSString *typeIdentifier;
    if ([url getResourceValue:&typeIdentifier forKey:NSURLTypeIdentifierKey
        error:NULL]) {
        NSArray *imageUTIs = [NSImage imageTypes];
         if ([imageUTIs containsObject:typeIdentifier]) {
              return [[[ATDesktopImageEntity alloc] initWithFileURL:url] autorelease];
         }else if ([typeIdentifier isEqualToString:(NSString *)kUTTypeFolder]){
              return [[[ATDesktopFolderEntity alloc] initWithFileURL:url] autorelease];
         }
    }
    return nil;
}

@synthesize fileURL = _fileURL;
@dynamic title;

- (id)initWithFileURL:(NSURL *)fileURL
{
    self = [super init];
    _fileURL = [fileURL retain];
    return self;
}

- (id)copyWithZone:(NSZone *)zone
{
    id result = [[[self class] alloc] initWithFileURL:self.fileURL];
    return result;
}

- (NSString *)description
{
     return [NSString stringWithFormat:@"%@ : %@", [super description], self.title];
}

- (void)dealloc
{
    [_fileURL release];
    [super dealloc];
}

- (NSString *)title
{
    NSString *result;
    if ([self.fileURL getResourceValue:&result forKey:NSURLLocalizedNameKey 
         error:NULL]) {
         return result;
    }
    return nil;
}

#pragma mark -
#pragma mark NSPasteboardWriting support

- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard
{
    return [self.fileURL writableTypesForPasteboard:pasteboard];
}

- (id)pasteboardPropertyListForType:(NSString *)type
{
   return [self.fileURL pasteboardPropertyListForType:type];
}

- (NSPasteboardWritingOptions)writingOptionsForType:(NSString *)type pasteboard:  
    (NSPasteboard *)pasteboard
{
    if ([self.fileURL respondsToSelector:@selector(writingOptionsForType:pasteboard:)]) 
         {
        return [self.fileURL writingOptionsForType:type pasteboard:pasteboard];
    }else{
        return 0;
    }
}

#pragma mark -
#pragma mark NSPasteboardReading support

+ (NSArray *)readableTypesForPasteboard:(NSPasteboard *)pasteboard 
{
    return [NSArray arrayWithObjects:(id)kUTTypeFolder, (id)kUTTypeFileURL, nil];
}
+ (NSPasteboardReadingOptions)readingOptionsForType:(NSString *)type pasteboard:
    (NSPasteboard *)pasteboard
{
    return NSPasteboardReadingAsString;
}

- (id)initWithPasteboardPropertyList:(id)propertyList ofType:(NSString *)type
{
    [self release];
    self = nil;

    NSURL *url = [[[NSURL alloc] initWithPasteboardPropertyList:propertyList
        ofType:type] autorelease];
    NSString *urlUTI;
    if ([url getResourceValue:&urlUTI forKey:NSURLTypeIdentifierKey error:NULL
        ]) {
        if ([[NSImage imageTypes] containsObject:urlUTI]) {
            self = [[ATDesktopImageEntity alloc] initWithFileURL:url];
        }else if ([urlUTI isEqualToString:(id)kUTTypeFolder]) {

            self = [[ATDesktopFolderEntity alloc] initWithFileURL:url];
        }
    }
    return self;
}

#pragma mark -

- (NSString *)imageUID
{
    return [NSString stringWithFormat:@"%p", self];
}

- (NSString *)imageRepresentationType
{
    return IKImageBrowserNSURLRepresentationType;
}

- (id)imageRepresentation
{
    return self.fileURL;
}

- (NSUInteger)imageVersion
{
    return 0;
}

- (NSString *)imageTitle
{
    return self.title;
}

- (NSString *)imageSubtitle
{
    return nil;
}

- (BOOL)isSelectable
{
    return YES;
}

@end


@interface ATDesktopImageEntity()

@property (readwrite, retain) NSImage *thumbnailImage;

@property (readwrite) BOOL imageLoading;

@end

static NSOperationQueue *ATSharedOperationQueue()
{
    static NSOperationQueue *_ATSharedOperationQueue = nil;
    if (_ATSharedOperationQueue == nil) {
        _ATSharedOperationQueue = [[NSOperationQueue alloc] init];
        [_ATSharedOperationQueue setMaxConcurrentOperationCount:2];
    }
    return _ATSharedOperationQueue;
}

@implementation ATDesktopImageEntity

- (id)initWithFileURL:(NSURL *)fileURL
{
    self = [super initWithFileURL:fileURL];

    static NSInteger lastColorIndex = 0;
    NSColorList *colorList = [NSColorList colorListNamed:@"Crayons"];
    NSArray *keys = [colorList allKeys];
    if (lastColorIndex >= keys.count) {
        lastColorIndex = 0;
    }
    _fillColorName = [[keys objectAtIndex:lastColorIndex++] retain];
    _fillColor = [[colorList colorWithKey:_fillColorName] retain];
    self.title = [super title];
    return self;
}

- (void)dealloc
{
    [_thumbnailImage release];
    [_image release];
    [_fillColor release];
    [_fillColorName release];
    [_title release];
    [super dealloc];
}

@synthesize fillColor = _fillColor;
@synthesize fillColorName = _fillColorName;
@synthesize imageLoading = _imageLoading;
@synthesize image = _image;
@synthesize thumbnailImage = _thumbnailImage;
@synthesize title = _title;

static NSImage *ATThumbnailImageFromImage(NSImage *image)
{
    NSSize imageSize = [image size];
    CGFloat imageAspectRatio = imageSize.width / imageSize.height;

   NSSize thumbnailSize = NSMakeSize(THUMBNAIL_HIEGHT * imageAspectRatio, 
      THUMBNAIL_HIEGHT);
   NSImage *thumbnailImage = [[NSImage alloc] initWithSize:thumbnailSize];
   [thumbnailImage lockFocus];
   [image drawInRect:NSMakeRect(0, 0, thumbnailSize.width, thumbnailSize.
       height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
   [thumbnailImage unlockFocus];

#if DEMO_MODE
     usleep(250000);
#endif

    return [thumbnailImage autorelease];
}

- (NSImage *)thumbnailImage
{
    if (self.image != nil && _thumbnailImage == nil) {
        _thumbnailImage = [ ATThumbnailImageFromImage(self.image) retain];
    }else if (self.image == nil && !self.imageLoading) {

        [self loadImage];
    }
    return _thumbnailImage;
}

- (void)loadImage
{
    @synchronized (self) {
        if (self.image == nil && !self.imageLoading) {
            self.imageLoading = YES;

            [ATSharedOperationQueue() addOperationWithBlock:^(void) {
                NSImage *image = [[NSImage alloc] initWithContentsOfURL:self.fileURL];
                if (image != nil) {
                    NSImage *thumbnailImage = ATThumbnailImageFromImage(image);

                    @synchronized (self) {
                        self.imageLoading = NO;
                        self.image = image;
                        self.thumbnailImage = thumbnailImage;
                    }
                    [image release];
                }else{
                    @synchronized (self) {
                        self.image = [NSImage imageNamed:NSImageNameTrashFull];
                    }
                }
            }];
         }
    }
}
@end;


@implementation ATDesktopFolderEntity

- (void)dealloc
{
    [_children release];
    [super dealloc];
}

@dynamic children;

- (NSMutableArray *)children
{
    NSMutableArray *result = nil;

    @synchronized (self) {

        if (_children == nil && self.fileURL != nil) {
            NSError *error = nil;

            NSArray *urls = [[NSFileManager defaultManager]
                             contentsOfDirectoryAtURL:self.fileURL
                           includingPropertiesForKeys:[NSArray
                                     arrayWithObjects:NSURLLocalizedNameKey, nil]
                                              options:        
                                              NSDirectoryEnumerationSkipsHiddenFiles |
                         NSDirectoryEnumerationSkipsSubdirectoryDescendants error:&error];
           NSMutableArray *newChildren = [[NSMutableArray alloc] initWithCapacity:urls.count];

           for (NSURL *url in urls) {
               NSString *typeIndentifier;
               if ([url getResourceValue:&typeIndentifier forKey:
                   NSURLTypeIdentifierKey error:NULL]) {
                   ATDesktopEntity *entity = [ATDesktopEntity entityForURL:url];
                   if (entity) {
                       newChildren addObject:entity];
                   }
               }
            }
            _children = newChildren;
        }
        result = [[_children retain] autorelease];
    }
    return result;
}

- (void)setChildren:(NSMutableArray *)value
{
    @synchronized (self) {
        if (_children != value) {
            [_children release];
            _children = [value retain];
        }
    }
}
@end

NSString *const ATEntityPropertyNamedFillColor = @"fillColor";
NSString *const ATEntityPropertyNamedFillColorName = @"fillColorName";
NSString *const ATEntityPropertyNamedImage = @"image";
NSString *const ATEntityPropertyNamedThumbnailImage = @"thumbnailImage";
#导入“ATDesktopEntity.h”
#进口
#定义缩略图高度180.0
#定义演示模式0
@桌面实体的实现
+(ATDesktopEntity*)entityForURL:(NSURL*)url{
NSString*类型标识符;
if([url getResourceValue:&typeIdentifier-forKey:NSURLTypeIdentifierKey
错误:NULL]){
NSArray*imageUTIs=[nsImageImageTypes];
if([imageUTIs containsObject:typeIdentifier]){
返回[[[ATDesktopImageEntity alloc]initWithFileURL:url]自动删除];
}else if([typeIdentifier IsequalString:(NSString*)kUTTypeFolder]){
返回[[[ATDesktopFolderEntity alloc]initWithFileURL:url]自动删除];
}
}
返回零;
}
@合成fileURL=\u fileURL;
@动态标题;
-(id)initWithFileURL:(NSURL*)fileURL
{
self=[super init];
_fileURL=[fileURL retain];
回归自我;
}
-(id)copyWithZone:(NSZone*)区
{
id result=[[[self class]alloc]initWithFileURL:self.fileURL];
返回结果;
}
-(NSString*)说明
{
返回[NSString stringWithFormat:@“%@:%@”,[super description],self.title];
}
-(无效)解除锁定
{
[_fileURL发布];
[super dealoc];
}
-(NSString*)标题
{
NSString*结果;
if([self.fileURL getResourceValue:&result-forKey:NSURLLocalizedNameKey
错误:NULL]){
返回结果;
}
返回零;
}
#布拉格标记-
#pragma标记NSPasteboardWriting支持
-(NSArray*)可写类型粘贴板:(NSPasteboard*)粘贴板
{
返回[self.fileURL writeabletypesforPasteBoard:pasteboard];
}
-(id)pasteboardPropertyListForType:(NSString*)类型
{
返回[self.fileURL pasteboardPropertyListForType:type];
}
-(NSPasteboardWritingOptions)WritingOptions for type:(NSString*)类型粘贴板:
(NSPasteboard*)粘贴板
{
if([self.fileURL respondsToSelector:@selector(writingOptionsForType:pasteboard:))
{
返回[self.fileURL writingOptionsForType:type粘贴板:粘贴板];
}否则{
返回0;
}
}
#布拉格标记-
#pragma标记NSPasteboardReading支持
+(NSArray*)可读类型粘贴板:(NSPasteboard*)粘贴板
{
返回[NSArray arrayWithObjects:(id)kUTTypeFolder,(id)kUTTypeFileURL,nil];
}
+(NSPasteboardReadingOptions)ReadingOptions for type:(NSString*)类型粘贴板:
(NSPasteboard*)粘贴板
{
返回NSPasteboardReadingAsString;
}
-(id)initWithPasteboardPropertyList:(id)类型为:(NSString*)的propertyList
{
[自我释放];
自我=零;
NSURL*url=[[[NSURL alloc]initWithPasteboardPropertyList:propertyList
类型:类型]自动释放];
NSString*urlUTI;
if([url getResourceValue:&urlUTI-forKey:NSURLTypeIdentifierKey]错误:NULL
]) {
如果([[NSImage imageTypes]包含对象:urlUTI]){
self=[[ATDesktopImageEntity alloc]initWithFileURL:url];
}else if([urlUTI IsequalString:(id)kUTTypeFolder]){
self=[[ATDesktopFolderEntity alloc]initWithFileURL:url];
}
}
回归自我;
}
#布拉格标记-
-(NSString*)图像UID
{
返回[NSString stringWithFormat:@“%p”,self];
}
-(NSString*)imageRepresentationType
{
返回IKImageBrowserNSURLRepresentationType;
}
-(id)图像表示
{
返回self.fileURL;
}
-(整数)图像版本
{
返回0;
}
-(NSString*)图像标题
{
返回自己的标题;
}
-(NSString*)图像字幕
{
返回零;
}
-(BOOL)是可选择的
{
返回YES;
}
@结束
@ATDesktopImageEntity()的接口
@属性(读写、保留)NSImage*thumbnailImage;
@属性(读写)BOOL-imageload;
@结束
静态NSOperationQueue*ATSharedOperationQueue()
{
静态NSOperationQueue*_ATSharedOperationQueue=nil;
如果(_ATSharedOperationQueue==nil){
_ATSharedOperationQueue=[[NSOperationQueue alloc]init];
[_atSharedOperationQueuesetMaxConcurrentOperationCount:2];
}
返回_ATSharedOperationQueue;
}
@desktopimageentity的实现
-(id)initWithFileURL:(NSURL*)fileURL
{
self=[super initWithFileURL:fileURL];
静态NSInteger LASTCOLORDINDEX=0;
NSColorList*colorList=[NSColorList colorListNamed:@“Crayons”];
NSArray*键=[colorList allKeys];
如果(lastColorIndex>=keys.count){
lastColorIndex=0;
}
_fillColorName=[[keys objectAtIndex:lastColorIndex++]retain];
_fillColor=[[colorList colorWithKey:_fillColorName]retain];
self.title=[超级标题];
回归自我;
}
-(无效)解除锁定
{
[_缩略图图像发布];
[_图像发布];
[颜色发布];
[_fillColorName发布];
[_标题发布];
[super dealoc];
}
@合成fillColor=\u fillColor;
@合成fillColorName=\u fillColorName;
@合成图像加载=_图像加载;
@合成图像=_图像;
@合成thumbnailImage=\u thumbnailImage;
@综合标题=_标题;
静态NSImage*ATTHMBUNNAILIMAGEFROMIMAGE(NSImage*image)
{
NSSize imageSize=[图像大小];
CGFloat imageAspectRatio=imageSize.WITH/imageSize.height;
NSSize thumbnailSize=NSMakeSize(缩略图高度*imageAspectRatio,
缩略图(高);
NSImage*thumbnailImage=[[NSImage alloc]initWithSize:thumbnailSize];
[缩略图图像锁定焦点];
[图像drawInRect:NSMakeRect(0,0,thumbnailSize.width,thumbnailSize。
高度)fromRect:NSZeroRect操作:NSComposite
#import "ATColorView.h"

#import <Quartz/Quartz.h>

@implementation ATColorView

+ (id)defaultAnimationForKey:(NSString *)key{
    if ([key isEqualToString:@"backgroundColor"]) {
        return [CABasicAnimation animation];
    }
    return [super defaultAnimationForKey:key];
}                      

- (void)dealloc
{
    self.backgroundColor = nil;
    [super dealloc];
}

@synthesize backgroundColor;
@synthesize drawBorder;

- (CGColorRef)createBackgroundColorRef
{
    CGFloat components[backgroundColor.numberOfComponents];
    [backgroundColor getComponents:components];
    return CGColorCreate([[backgroundColor colorSpace] CGColorSpace],components);
}

- (void)setBackgroundColor:(NSColor *)value 
{
    if (backgroundColor != value) {
        [backgroundColor release];
        backgroundColor = [value retain];
        if (self.layer == nil) {
            CGColorRef backgroundColorRef = [self createBackgroundColorRef];
            self.layer.backgroundColor = backgroundColorRef;
            CGColorRelease(backgroundColorRef);
        }
        [self setNeedsDisplay:YES];
    }
}

- (void)drawRect:(NSRect)r
{
    NSColor *color = [self backgroundColor];
    if (color) {
        [color set];
        NSRectFill(r);
    }
    if (self.drawBorder) {
       [[NSColor lightGrayColor] set];
       NSFrameRectWithWidth(self.bounds, 1.0);
    }
    if (self.window.firstResponder == self) {
        NSSetFocusRingStyle(NSFocusRingOnly);
        NSRectFill(self.bounds);
    }
}

- (void)mouseUp:(NSEvent *)theEvent
{
   NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
  if (NSPointInRect(point, self.bounds) && self.action) {
      [NSApp sendAction:self.action to:self.target];
  }
}

+ (Class)cellClass {
   return [NSActionCell class];
}

@end