Here
- (IBAction)playSound:(id)sender {
AudioServicesPlaySystemSound(_yayFileID);
}
the variable _yayFileID
refers to a variable in your MainViewController
which is completely unrelated to the yayFileID
variable in TheSound
object.
Maybe if you try
AudioServicesPlaySystemSound(foo.yayFileID);
Even if you do this, I don't think it will work, because additionally, your foo
variable is not initialized, so the call initSound
is being sent to null. You should do something like this
foo = [[TheSound alloc] init];
[foo initSound];