Xcode - symbol(s) not found for architecture x86_64
So, I dabbled in Objective-C the other day, trying to use JSONModel to parse the following JSON to an Objective-C object named AppConfig
:
{
"SpotifyClientId": "[SpotifyClientId]",
"SpotifyClientSecret": "[SpotifyClientSecret]",
"YouTubeServiceId": "[YouTubeServiceId]"
}
Sounds straightforward.
The JSONModel documentation says:
declare properties in your header file with the name of the JSON keys
There’s no need to do anything in the implementation (.m) file.
Easy.
// AppConfig.h
#import <JSONModel/JSONModel.h>
@interface AppConfig : JSONModel
@property (nonatomic) NSString *SpotifyClientId;
@property (nonatomic) NSString *SpotifyClientSecret;
@property (nonatomic) NSString *YouTubeServiceId;
@end
// AppConfig.m
#import "AppConfig.h"
Some of you will already see the error of my ways.
Building the target gave this informative error message:
Undefined symbols for architecture x8664:
“_OBJC_CLASS$_AppConfig”, referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After Googling and finding this comment on Stack Overflow, I realized the AppConfig class was missing its implementation:
// AppConfig.m
#import "AppConfig.h"
@implementation AppConfig
@end
Finally, it builds!