【发布时间】:2012-07-28 22:23:16
【问题描述】:
您好,我正在创建一个动态表视图,并尝试从存储在其他文件中的方法上传信息。当我尝试测试是否获得信息时,我得到了 Macho Linker Error
架构 i386 的未定义符号: “_OBJC_CLASS_$_FlickrFetcher”,引用自: MyTableViewController.o 中的 objc-class-ref ld:未找到架构 i386 的符号
这是我添加的导致问题的代码。
FlickerFetcher.h 这有我的 tableViewController 调用 topPlaces 的方法
@interface FlickrFetcher : NSObject
+ (NSArray *)topPlaces;
+ (NSArray *)photosInPlace:(NSDictionary *)place maxResults:(int)maxResults;
+ (NSURL *)urlForPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format;
@end
TableViewController 文件。我认为当我懒惰地实例化它时,问题出现在 setter Brain 中,因为代码在我添加它之前工作正常,NSlog 返回 NUll 因为没有对象但它正在工作,然后当我添加 setter 以实例化它时,我得到了Macho 链接器错误。
#import "MyTableViewController.h"
#import "FlickrFetcher.h"
@interface MyTableViewController ()
@property (nonatomic, strong) FlickrFetcher* brain;
@end
@implementation MyTableViewController
@synthesize brain= _brain;
//Error occured after I added this setter
-(FlickrFetcher*) brain
{
if (!_brain) _brain= [[FlickrFetcher alloc] init];
return _brain;
}
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
//use a class method call since this is a class method
NSLog(@"Class = %@", [self.brain class]);
NSLog(@"Array = %@", [[self.brain class] topPlaces]);
}
【问题讨论】:
-
真的没有人知道如何提供帮助吗?
-
更多 StackOverflow 礼仪:如果您解决了自己的问题,最好将解决方案作为答案发布,然后接受答案。它可以帮助其他正在寻找相同问题的人找到解决方案!
-
好的,谢谢,我按照你的建议做了
标签: objective-c xcode class linker mach-o