【发布时间】:2011-12-06 15:50:16
【问题描述】:
当我运行这个程序时,它总是显示程序接收到的信号 SIGABRT。下面是我修改的代码,尤其是 AVAudioPlayer。我的代码有什么问题吗?问题是什么?这里是断点:int retVal = UIApplicationMain(argc, argv, nil, nil);
-(IBAction) start {
{
self.playBgMusic.enabled = YES;
[self.player play];
}
}
-(IBAction) stop {
{
self.playBgMusic.enabled = NO;
[self.player stop];
}
}
-(void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)completed
{
if(completed == YES){
self.playBgMusic.enabled = YES;
}
}
- (void)viewDidLoad
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"music" ofType:@"mp3"];
self.player=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
player.delegate = self;
[player play];
player.numberOfLoops = -1;
[super viewDidLoad];
}
- (void)viewDidUnload
{
[player stop];
[super viewDidUnload];
}
【问题讨论】:
-
您应该发布有关问题的更多信息,而不是程序本身。 SIGABRT 很常见,可能是由很多事情引起的。我怀疑你不知道什么是 SIGABRT,所以你可以在这里阅读:SIGABRT。堆栈上的其他问题:Other topics on SIGABRT in StackOverflow - 可能会回答您,或者至少他们肯定会帮助您。
标签: xcode4