Ios SKAction PlaySoundFileName没有通过iphone扬声器播放音频

Ios SKAction PlaySoundFileName没有通过iphone扬声器播放音频,ios,iphone,audio,sprite-kit,skaction,Ios,Iphone,Audio,Sprite Kit,Skaction,是否有人在通过iOS设备的外部扬声器通过名为using iOS Sprite Kit的SKAction PlaySoundFile播放音频时遇到问题?我有以下代码,通过耳机播放M4A文件,没有问题;然而,当我拔下耳机时,没有音频播放,它只执行没有声音的代码。我有另一个应用程序,不使用这种方法,它发挥没有问题 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { /* Called when a touch be

是否有人在通过iOS设备的外部扬声器通过名为using iOS Sprite Kit的SKAction PlaySoundFile播放音频时遇到问题?我有以下代码,通过耳机播放M4A文件,没有问题;然而,当我拔下耳机时,没有音频播放,它只执行没有声音的代码。我有另一个应用程序,不使用这种方法,它发挥没有问题

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    /* Called when a touch begins */

    for (UITouch *touch in touches) {
        CGPoint location = [touch locationInNode:self];
        SKAction *sound = [SKAction playSoundFileNamed:@"blast.m4a" waitForCompletion:NO];
        [self runAction:sound];
 }

为了更新,我今天安装了IOS 7.0.4并重新测试,现在我的外部扬声器上有音频,所以我假设这是IOS 7.0.3中的一个错误,因为这是我对设备所做的唯一更改。

我有一个类似的问题,但可以通过将AudioSession类别设置为播放来修复它。这会导致未插入耳机时音频通过手机扬声器传输

// at the top of AppDelegate.m
#import <AVFoundation/AVFoundation.h>

// in application:didFinishLaunchingWithOptions:
NSError *error;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error];
//在AppDelegate.m的顶部
#进口