I am trying to write a category over iTunesTrack with associated objects (an NSMutableDictionary and an NSNumber)
#import "iTunes.h"
#import <objc/runtime.h>
@interface iTunesTrack (dictionary)
- (NSMutableDictionary*) getDictionary;
- (NSNumber*) getScan;
- (BOOL)scanTrack:(NSString *)equationString;
@end
This fails:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_iTunesTrack", referenced from:
l_OBJC_$_CATEGORY_iTunesTrack_$_dictionary in iTunesTrack+dictionary.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have double checked that the Scripting Bridge framework is added and that the iTunesTrack+dictionary.m file is attached to the target. Could this be some error with combining Categories with Scripting Bridge?
Update:
If I replace iTunesTrack with SBObject, this works. I have no idea why, though.
Update 2:
This problem is reproducible:
- Create new project
- Add Scripting Bridge Framework and the iTunes.h header file.
- Create new category of iTunesTrack with an arbitrary name
- Ensure that
iTunesTrack+name.h
importsiTunes.h
- Build
I found this page which describes using NSProxy and NSCache to store iTunesTrack objects. Would this be a better solution than trying to make a category?