So this is what I have done.
I'm building to 2.2.1.
AppDelegate.h
Code:
AVAudioPlayer* sound1Player;
ViewController.m
Code:
- (IBAction)playAgain {
NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
AVAudioPlayer* sound1Player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[sound1Player play];
}
This works but will stop responding after a while of game play.
Then if I try to flip the view, after the sound stops responding, I get this as the game crashes
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Data Formatters unavailable (0x100a25 "dlopen(/Developer/usr/lib/libXcodeDebuggerSupport.dylib, 10): no suitable image found. Did find:\n\t/Developer/usr/lib/libXcodeDebuggerSupport.dylib: open() failed with errno=24\n\t/Developer/usr/lib/lib"...)
Then I tried this, built to 2.2.1, and tried it with 3.1.2.
ViewController.h
Code:
AVAudioPlayer* sound1Player;
}
@property (nonatomic, retain) AVAudioPlayer *sound1Player;
ViewController.m
Code:
@synthesize sound1Player;
- (IBAction)playAgain {
NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
sound1Player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
sound1Player.delegate = self;
[sound1Player play];;
}
This works but will stop responding after a while of game play.
Then if I try to flip the view, after the sound stops responding, I get this
again as the game crashes.
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Data Formatters unavailable (0x100a25 "dlopen(/Developer/usr/lib/libXcodeDebuggerSupport.dylib, 10): no suitable image found. Did find:\n\t/Developer/usr/lib/libXcodeDebuggerSupport.dylib: open() failed with errno=24\n\t/Developer/usr/lib/lib"...)