I am getting this error for a single class from a static library, which I have compiled myself. It has all been working fine and I wanted to add another class as a simple data transfer object called PPClientData. The error is:
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_PPClientData", reference from: objc-class-ref in CPPIntegrationDelegate.o
The relevant file is included in the library compile targets and I have used otool -d on the (fat) library and it shows
libPPIntegration.a(PPClientData.o) (architecture armv7): (__DATA,--data) section
The header for the class (PPClientData.h), which is included in the app is like this:
#import <Foundation/Foundation.h>
@interface PPClientData : NSObject
@property(nonatomic, strong) NSString* clientId;
// 3 others identical to the above with different names
@end
and the .m file which should be compiled into the library looks like this:
#import "PPClientData.h"
@implementation PPClientData
@synthesize clientId;
//Synthesize others
-(id)init {
self = [super init];
return self;
}
@end
It is consumed in a single class in the app as follows. If this one function that consumes it is commented out, the linker error goes away (it links to other classes in the library) but with this in, it fails. This is a delegate function for the library.
#import "CPPIntegrationDelegate.h"
#import "PPClientData.h"
@implementation CPPIntegrationDelegate
// Various other functions that work fine
-(PPClientData*)clientData:(PPIntegration*)integration {
PPClientData* dict = [[PPClientData alloc]init]; // This is the line that causes the linker error
dict.clientId = @"whatever";
// set other properties of dict
return dict;
}
I understand what the linker is trying to do and what the error suggests but I don't see what I've missed. Can anyone help?