I have a project that uses the Core Telephony framework. Recently my code stopped working on a CTCarrier
category, the linker complains that it can’t find the CTCarrier
class:
Undefined symbols:
"_OBJC_CLASS_$_CTCarrier", referenced from:
l_OBJC_$_CATEGORY_CTCarrier_$_Foo in CTTests.o
ld: symbol(s) not found
This is a sample code that triggers the error above:
#import <CoreTelephony/CTCarrier.h>
@interface CTCarrier (Foo)
- (void) doFoo;
@end
@implementation CTCarrier (Foo)
- (void) doFoo {}
@end
If I change the category to class extension, the code suddenly builds:
#import <CoreTelephony/CTCarrier.h>
@interface CTCarrier ()
- (void) doFoo;
@end
@implementation CTCarrier
- (void) doFoo {}
@end
What’s going on? Sample code on GitHub.