iPhone SDK:AVAudioRecorder的初始化返回nil [英] iphone sdk: initialization of a AVAudioRecorder returns nil

查看:51
本文介绍了iPhone SDK:AVAudioRecorder的初始化返回nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用aac格式初始化AVAudioRecorder.为此,我使用以下代码:

I want to initialize a AVAudioRecorder with the aac Format. To do so, I use the following code:

soundFilePath = [soundFilePath stringByAppendingPathExtension:@"aac"];NSURL *url = 
[NSURL fileURLWithPath:soundFilePath isDirectory:FALSE];

NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue:[NSNumber numberWithInt: 'aac '] forKey:AVFormatIDKey];                                     
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVEncoderAudioQualityKey];                //Encoder Settings 
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVSampleRateConverterAudioQualityKey];    //Sample Rate Conversion Settings

_recorder = [[AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:nil];

为什么这行不通?如果我将AAC更改为ima4,则ID确实有效!

why doesn't this work? Id does work, if I change aac into ima4!

推荐答案

'aac'不在预定义的格式ID中,因此不起作用.您可以查看受支持的音频类型常量,以获取所有这些常量的列表.它们可用此处

'aac' is not among the predefined format ids and so it doesnot work. U can have a look at the supported audiotype constants for getting a list of all these. They are availab here

在常数"部分.

这篇关于iPhone SDK:AVAudioRecorder的初始化返回nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆