Can I create an extern SystemSoundID
I have a global file which I import into my prefix.pch file. I have a few constants that I store in there such as prefkeys and other constant strings. I was wondering if it is possible to create a global SystemSoundID from there as well. I get a linker error saying that :
Undefined symbols for architecture i386:
"_clackOffSound", referenced from:
//the place in which I am referencing it
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I am defining the SystemSoundID as:
extern SystemSoundID const clackOffSound; //I have also tried excluding the const
NSString *clackPath = [[NSBundle mainBundle] pathForResource:@"clackOff" ofType:@"aif"];
NSURL *clackUR开发者_Go百科L = [NSURL fileURLWithPath:clackPath];
AudioServicesCreateSystemSoundID( (CFURLRef) clackURL, &clackOffSound);
/**** I have also tried this in my appDelegate +(void)initialize method ***/
I want to import this sound into a global file so I don't have to allocate the SystemSoundID in just about every view controller in my application. Is this bad practice, or is it just impossible?
Thanks
Saam
精彩评论