Reputation: 481
Hi I am creating a dynamic Table View and am trying to upload the information from methods stored in other files. When I try to test if I am getting the information I get the Macho Linker Error
Undefined symbols for architecture i386: "_OBJC_CLASS_$_FlickrFetcher", referenced from: objc-class-ref in MyTableViewController.o ld: symbol(s) not found for architecture i386
Here is my code that I added that resulted in the problem.
FlickerFetcher.h This has the methods which my tableViewController calls topPlaces
@interface FlickrFetcher : NSObject
+ (NSArray *)topPlaces;
+ (NSArray *)photosInPlace:(NSDictionary *)place maxResults:(int)maxResults;
+ (NSURL *)urlForPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format;
@end
TableViewController File. I think the problem occurs in the setter Brain when I lazily instatiate it because the code was working fine before I added it, the NSlog returned NUll since there was no object but it was working, then when I added the setter to instatiate it I got the Macho Linker Error.
#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]);
}
Upvotes: 1
Views: 4810
Reputation: 11
objc-class-ref
section includes the class info you application used. it can find MyTableViewController
, but can't find FlickrFetcher
class info.
so the problem is the FlickrFetcher
class didn't add to the compile arch.
Upvotes: 0
Reputation: 481
I discovered the error, turns out that the file FlickrFetcher was not compiling or in the compile list, I fixed this by clicking on my project in the navigation menu, going under targets and clicking my application, going into build phases and then adding the file in compile sources. Hope that helps anyone with this problem
Upvotes: 6