3

これは長い間私を夢中にさせてきました。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;

アプリはクラッシュせず、サウンドも正常に再生されますが、デバッガーは常にその 1 行で一時停止します。別の場所に移動しても、一時停止します。実行を続行でき、問題なく動作しますが、これは本当に私を悩ませます。

一時停止する理由がわかりません。何か案は?

4

2 に答える 2

4

Xcode が prepareToPlay で停止するのコメントで説明されているように、ブレークポイントの理由は、c++ ライブラリによって起動されるシグナルに応答する「すべての例外」タイプの汎用ブレークポイントを設定していたためです。このような場合に備えて、"Objective-c" 例外ブレークポイントを使用することをお勧めします。

于 2014-09-04T21:23:46.023 に答える