【发布时间】:2011-04-09 22:10:03
【问题描述】:
这是代码
目标.h
#import <UIKit/UIKit.h>
#import <CoreGraphics/CGPDFArray.h>
@class Model;
// snip
@interface Dest : NSObject
{
CGPDFArrayRef destArray;
DestKind kind;
}
+ (id)destWithObject:(CGPDFObjectRef)obj inModel:(Model*)model;
- (id)initWithArray:(CGPDFArrayRef)array;
目标.m
@implementation Dest
+ (id)destWithObject:(CGPDFObjectRef)obj inModel:(PDFModel*)model
{
CGPDFArrayRef array = NULL;
Dest* dest = nil;
// stuff to create array
if (array)
{
dest = [[[Dest alloc] initWithArray:array] autorelease];
<path>/Dest.m:63: warning: passing argument 1 of 'initWithArray:' from incompatible pointer type
}
return dest;
}
显然编译器认为数组与Dest.h 中声明的initWithArray: 不兼容。但据我所见,类型完全正确。我什至从Dest.h 复制了声明并将其粘贴到Dest.m。 initWithArray: 编译良好。在Dest.h 中添加/删除CGPDFArray.h 头文件没有任何区别,编译器认为它不是Dest.h 中的int。
【问题讨论】:
标签: iphone objective-c ios