操作系统状态错误 1718449215

发布于 2024-10-04 04:36:33 字数 337 浏览 6 评论 0原文

我创建了一个 iPhone 应用程序来录制我们的声音。当我尝试记录时,我在以下语句中收到错误消息。


recorder = [[ AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:&err];

错误域=NSOSStatusErrorDomain代码=1718449215“操作无法完成。(OSStatus错误1718449215。)”

如果我尝试在.caf文件中记录,它工作正常。如果我尝试使用 .m4a,我会收到此错误消息。

请帮我解决它。

谢谢。

I have created an iPhone application to record our voice. When I try to record, I am getting error message in following statement.


recorder = [[ AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:&err];

Error Domain=NSOSStatusErrorDomain Code=1718449215 "Operation could not be completed. (OSStatus error 1718449215.)"

If I tried to record in .caf file, it is working fine. If I tried with .m4a, I am getting this error message.

Please help me to resolve it.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

追风人 2024-10-11 04:36:33

1718449215 是 kAudioFormatUnsupportedDataFormatError 错误的四字符代码的十进制表示形式。

一般来说,您可以使用类似的方法从收到的错误中获取更多信息:

NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain
                          code:my_error_code
                          userInfo:nil];
NSLog(@"Error: %@", [error description]);

1718449215 is the decimal representation of the four character code for the kAudioFormatUnsupportedDataFormatError error.

In general you can use something like this to get more information from the errors you receive:

NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain
                          code:my_error_code
                          userInfo:nil];
NSLog(@"Error: %@", [error description]);
冰雪之触 2024-10-11 04:36:33

如果这对其他人有帮助:我刚刚遇到了同样的错误,这是由于尝试以错误的格式创建/使用音频文件引起的。我已预设录音以创建 .caf 文件,但将其命名为 xxx.wav 文件。

In case this helps others: I just had the same error, and it was caused by trying to create/use audio files in the wrong format. I had preset the recording to create a .caf file, but instead, called the file xxx.wav.

心如狂蝶 2024-10-11 04:36:33

OSStatus 错误代码很痛苦,它们通常太笼统,无法提供帮助。您是否尝试解码四字符错误代码?有时这会有所帮助(有时你只会得到垃圾)。创建并向我们展示一个展示问题的最小代码示例。在这种情况下,我打赌四字符代码是 fmt?。谷歌一下数字代码,你应该更聪明。

OSStatus error codes are pain, they are often too general to help. Did you try to decode the four-char error code? Sometimes that helps (other times you just get garbage). Create and show us a minimal code example that exhibits the problem. In this case I bet that the four-char code is fmt?. Google for the numeric code and you should be wiser.

生来就爱笑 2024-10-11 04:36:33

当我将文件类型转换为 .mp3 时,我也遇到了这个问题,而之前我使用 .caf 格式通过 AVAudioRecorder 录制声音。我再次将文件类型转换为 .caf 格式 &有用。您可以使用以下格式

AAC、PCM、IMA4、ULAW、ILBC

I also faced this issue when I converted file type to .mp3 while previously I was using .caf format for recording sound with AVAudioRecorder. I again converted file type to.caf format & it works. You may use following formats

AAC, PCM, IMA4, ULAW, ILBC

丶情人眼里出诗心の 2024-10-11 04:36:33

“NSDictionary”如果为空,默认是高质量,如果设置了,这个值会很低,你可以尝试取消这些参数:

setting[AVFormatIDKey] = @(kAudioFormatAppleIMA4);
setting[AVSampleRateKey] = @(600.0);
setting[AVNumberOfChannelsKey] = @(1);
setting[AVLinearPCMBitDepthKey] = @(8);

"NSDictionary" if it is empty, the default is high quality, if you set, this value will be very low, you can try to cancel these parameters:

setting[AVFormatIDKey] = @(kAudioFormatAppleIMA4);
setting[AVSampleRateKey] = @(600.0);
setting[AVNumberOfChannelsKey] = @(1);
setting[AVLinearPCMBitDepthKey] = @(8);
拥醉 2024-10-11 04:36:33

我最喜欢的解密 OSStatus 代码的工具是 https://osstatus.com

OSStatus 错误 1718449215 是 kAudioConverterErr_FormatNotSupported,这可能意味着:

  • 不支持您尝试导出的格式(请仔细检查输出文件 URL 的文件扩展名)。

  • recordSettings 存在问题。需要注意的一件事是 AVFormatIDKey 的值与输出文件 URL 的文件扩展名匹配。

My favourite tool for deciphering OSStatus codes is https://osstatus.com

OSStatus error 1718449215 is kAudioConverterErr_FormatNotSupported, which may mean:

  • The format you're trying to export to is not supported (double check the file extension of your output file URL).

  • There's an issue with the recordSettings. One thing to look out for is that the value of the AVFormatIDKey matches the file extension of the output file URL.

拧巴小姐 2024-10-11 04:36:33

如果您使用 c 或 cpp 代码,则可以执行此操作。

char code[4];
*((SInt32*)&code[0]) = error;

If you're in c or cpp code you can do this.

char code[4];
*((SInt32*)&code[0]) = error;
山人契 2024-10-11 04:36:33
UInt32 code = CFSwapInt32HostToBig(error);
NSLog(@"%4.4s"(char *)&code);
UInt32 code = CFSwapInt32HostToBig(error);
NSLog(@"%4.4s"(char *)&code);
小矜持 2024-10-11 04:36:33

此问题是由于保存文件格式造成的。在IOS中使用WAV格式

This issue is because of save file format. in IOS use WAV format

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文