Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS 7可以';t使用音频会话通过蓝牙接收器接收音频_Ios_Iphone_Audio_Ios7_Bluetooth - Fatal编程技术网

iOS 7可以';t使用音频会话通过蓝牙接收器接收音频

iOS 7可以';t使用音频会话通过蓝牙接收器接收音频,ios,iphone,audio,ios7,bluetooth,Ios,Iphone,Audio,Ios7,Bluetooth,我在iOS 7上使用蓝牙应用程序时遇到问题。 更准确地说,我想连接的蓝牙接收器是: 当然,在我开始测试之前,iPhone已经与设备配对 我的应用程序应该使用EZAudio框架进行音频传输(从麦克风到扬声器)。它可以使用iPhone耳机正常工作,但不能使用蓝牙 下面是我放在delegate类(didFinishLaunchingWithOptions函数)中初始化音频会话的代码: // configure the audio session AVAudioSession *audioSession

我在iOS 7上使用蓝牙应用程序时遇到问题。 更准确地说,我想连接的蓝牙接收器是:

当然,在我开始测试之前,iPhone已经与设备配对

我的应用程序应该使用EZAudio框架进行音频传输(从麦克风到扬声器)。它可以使用iPhone耳机正常工作,但不能使用蓝牙

下面是我放在delegate类(didFinishLaunchingWithOptions函数)中初始化音频会话的代码:

// configure the audio session
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = NULL;

// deactivate session
[audioSession setActive:NO error:&err];
if (err) {
    NSLog(@"There was an error deactivating the audio session");
}

[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&err];
if( err ){
    NSLog(@"There was an error creating the audio session");
}

[audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&err];
if( err ){
    NSLog(@"There was an error sending the audio to the speakers");
}

// Activate the session
[audioSession setActive:YES error:&err];
然后我使用EZAudio框架将音频发送到音频设备:

/**
 Start the output
 */
[EZOutput sharedOutput].outputDataSource = self;
[[EZOutput sharedOutput] startPlayback];
有人知道这个问题吗?我错过什么了吗


谢谢你的帮助

应将类别设置为
AVAudioSessionCategoryPlayback
。当您将蓝牙设备设置为
AVAudioSessionCategoryPlayAndRecord
时,蓝牙设备需要可用于输入和输出。如果没有,设备将默认使用内置扬声器播放。

没有想法?没有人面临同样的问题?