Quote:
Originally Posted by BrianSlick
That looks fine.
The data formatters message could indicate a memory issue. Add log messages to the didReceiveMemoryWarning methods and find out if those are triggering.
Really there are too many possibilities to give you much help without more code.
|
Code:
#import "Stage_2.h"
#import "Stage_3.h"
#import "IPHONEAPP.h"
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
@implementation Stage_2
@synthesize audioPlayer, audioPlayer2;
//Stage_3 Parts- View/Alert/Auido
//
//
-(IBAction) stage_3 {
//View Switch
Stage_3 *screen = [[Stage_3 alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:screen animated:YES];
[screen release];
//Audio-Make sure the audio is at the start of the stream.
self.audioPlayer.currentTime = 0;
[self.audioPlayer play];
}
//backHome Parts- View/Alert/Vibrate/Audio
//
//
-(IBAction)backHome {
//View Switch
IPHONEAPPViewController *screen = [[IPHONEAPPViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:screen animated:YES];
[screen release];
//Alert
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Woops..."
delegate:self cancelButtonTitle:@"Try Again?" otherButtonTitles:nil];
[alert show];
[alert release];
//Vibrate
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
//Audio-Make sure the audio is at the start of the stream.
self.audioPlayer2.currentTime = 0;
[self.audioPlayer2 play];
}
//viewDidLoad Parts
//
//
- (void) viewDidLoad {
//Sound "Foward"
//
//
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"fowardSound"ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
self.audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:fileURL error:nil];
[self.audioPlayer prepareToPlay];
[filePath release];
[fileURL release];
//Sound "Back"
//
//
NSString *filePath2 = [[NSBundle mainBundle] pathForResource:@"backSound"ofType:@"mp3"];
NSURL *fileURL2 = [[NSURL alloc] initFileURLWithPath:filePath2];
self.audioPlayer2 = [[AVAudioPlayer alloc]
initWithContentsOfURL:fileURL2 error:nil];
[self.audioPlayer2 prepareToPlay];
[filePath2 release];
[fileURL2 release];
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[audioPlayer release];
[audioPlayer2 release];
[super dealloc];
}
@end