我有一个全局文件,我导入到我的prefix.pch文件中。我有一些常量存储在那里,如prefkeys和其他常量字符串。 我想知道是否有可能从那里创建一个全局SystemSoundID。我收到链接器错误说:
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
我将SystemSoundID定义为:
extern SystemSoundID const clackOffSound; //I have also tried excluding the const
NSString *clackPath = [[NSBundle mainBundle] pathForResource:@"clackOff" ofType:@"aif"];
NSURL *clackURL = [NSURL fileURLWithPath:clackPath];
AudioServicesCreateSystemSoundID( (CFURLRef) clackURL, &clackOffSound);
/**** I have also tried this in my appDelegate +(void)initialize method ***/
我想将此声音导入到全局文件中,因此我不必在应用程序的每个视图控制器中分配SystemSoundID。这是不好的做法,还是只是不可能?
由于
萨姆