【发布时间】:2013-06-17 14:23:58
【问题描述】:
这让我发疯了很长时间。我正在使用 Xcode 4.6,但这已经发生在几个版本中。当我打开断点并添加异常断点时,它总是在我设置音频播放器的代码行上暂停。我在之前和之后设置了一些相同的方式,但它只在那个暂停。
这是我正在使用的代码:
[[AVAudioSession sharedInstance] setDelegate: self];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil];
NSError *activationError = nil;
[[AVAudioSession sharedInstance] setActive: YES error: &activationError];
self.playedSongs = [NSMutableSet setWithCapacity:9];
[self loadSettingsFromFile];
NSURL *sfxPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Snap.aiff" ofType:nil]];
self.snapSfx = [[[AVAudioPlayer alloc]initWithContentsOfURL:sfxPath error:nil]autorelease];
self.snapSfx.volume = 1.f;
NSURL *fireworksPath;
if ([OriginalIPadChecker isNotiPadOriginal]) {
fireworksPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"FireworksSFX.mp3" ofType:nil]];
}
else{
fireworksPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"NoFireworksSFX.mp3" ofType:nil]];
}
self.fireWorksSfx = [[[AVAudioPlayer alloc]initWithContentsOfURL:fireworksPath error:nil]autorelease];
self.fireWorksSfx.volume = 1.f;
NSURL *poofPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Remove Poof.mp3" ofType:nil]];
//The line below is the one that it pauses on
self.removePoof = [[[AVAudioPlayer alloc]initWithContentsOfURL:poofPath error:nil]autorelease];
self.removePoof.volume = 1.f;
NSURL *newHighScorePath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"New High Score.mp3" ofType:nil]];
self.theNewHighScore = [[[AVAudioPlayer alloc]initWithContentsOfURL:newHighScorePath error:nil]autorelease];
self.theNewHighScore.volume = 1.f;
NSURL *badgeInTrophyPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Badge In Trophy.aiff" ofType:nil]];
self.badgeInTrophy = [[[AVAudioPlayer alloc]initWithContentsOfURL:badgeInTrophyPath error:nil]autorelease];
self.badgeInTrophy.volume = 1.f;
NSURL *dingPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Ding.aif" ofType:nil]];
self.ding = [[[AVAudioPlayer alloc]initWithContentsOfURL:dingPath error:nil]autorelease];
self.ding.volume = 1.f;
应用程序不会崩溃并且声音播放正常,但调试器总是在那一行暂停——即使我将它移到其他地方,它仍然会暂停。我可以继续执行,它工作得很好,但这真的让我很烦。
我不明白为什么它会暂停。有什么想法吗?
【问题讨论】:
-
你在 XCode v4.6.2 吗?
-
@MarcusAdams 4.6.1 但正如我所说,这已经发生在许多版本中,我认为这不仅仅是 xcode 中的一个错误。
标签: ios objective-c xcode debugging breakpoints