AudioFileOpenURL在现有文件上返回-43 [英] AudioFileOpenURL returns -43 on an existing file
问题描述
我的应用程序中有一个步骤,用户会反复听到三个语音数字。
I have a step in my application where a user repeatedly hears three spoken digits.
如果我将该步骤运行一段时间(对于某些未定义的 while),我的调试日志将显示以下内容(删除了不相关的日志条目):
If I leave this step running for a while (for certain undefined values of "while"), my debug logs show this (irrelevant log entries removed):
2010-03-01 13:44:21.283 iPhoneHearChk[1236:207] AudioFileOpenURL returned 0
(for <file://localhost/var/mobile/Applications/3A28F975-EAD5-4A5B-AFE6-FA1C6EE95732/iPhoneHearChk.app/5b3.ima4>)
2010-03-01 13:44:35.493 iPhoneHearChk[1236:207] AudioFileOpenURL returned 0
(for <file://localhost/var/mobile/Applications/3A28F975-EAD5-4A5B-AFE6-FA1C6EE95732/iPhoneHearChk.app/5b3.ima4>)
2010-03-01 13:45:17.916 iPhoneHearChk[1236:207] AudioFileOpenURL returned 0
(for <file://localhost/var/mobile/Applications/3A28F975-EAD5-4A5B-AFE6-FA1C6EE95732/iPhoneHearChk.app/5b3.ima4>)
2010-03-01 13:47:00.408 iPhoneHearChk[1236:207] AudioFileOpenURL returned -43
(for <file://localhost/var/mobile/Applications/3A28F975-EAD5-4A5B-AFE6-FA1C6EE95732/iPhoneHearChk.app/5b3.ima4>)
根据我的阅读,MacErrors.h将-43定义为fnErr,未找到文件。但是显然文件确实存在,因为我之前已经成功打开了它。
From what I've read, MacErrors.h defines -43 as fnErr, File Not Found. But clearly the file does exist, because I've successfully opened it before. What gives?
我如何打开文件:
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: name ofType: type];
if (!soundFilePath) { NSLog(@"No path found for sound file %@.%@", name, type); }
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
rc = AudioFileOpenURL((CFURLRef) fileURL, kAudioFileReadPermission, 0, &file);
其中文件是AudioFileID instvar,名称和类型是NSString *参数。
where file is an AudioFileID instvar and name and type are NSString * parameters.
推荐答案
是否有可能文件句柄用完了?完成文件后,您是否关闭打开的文件?
Is it possible that you are running out of file handles? Do you close the files you open after you are finished with them?
这篇关于AudioFileOpenURL在现有文件上返回-43的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!