UIView willMoveToSuperview error
I get this random error when I run my app on my iPhone.
First, I tap this method-
-(IBAction)playBeat1 {
NSString *path = [[NSBundle mainBundle] pathForReso开发者_如何学编程urce:@"beat1" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[theAudio play];
NSLog(@"Beatmaker");
}
Then when I tap this (It changes Views)-
-(IBAction) back{
[self dismissModalViewControllerAnimated:YES];
}
I get this error
UIView willMoveToSuperview:]: message sent to deallocated instance 0x1b1a20
Any Ideas?
You are dismissing a modal view controller that is already deallocated. The best way to deal with this is to activate NSZombies (search on SO). But if you show us where you present the modal view, we can probably give you more advice. My guess is that you should use this instead:
[self.parentViewController dismissModalViewControllerAnimated:YES];
But I would have to see more code to know.
playBeat1
doesn't seem to have anything to do with your problem.
精彩评论