AudioFileOpenURL 对现有文件返回 -43
我的应用程序中有一个步骤,用户反复听到三个口头数字。
如果我让此步骤运行一段时间(对于某些未定义的“while”值),我的调试日志会显示以下内容(删除了不相关的日志条目):
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,File Not成立。但显然该文件确实存在,因为我之前已经成功打开过它。什么给?
如何打开文件:
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);
其中 file 是 AudioFileID instvar,名称和类型是 NSString * 参数。
I have a step in my application where a user repeatedly hears three spoken digits.
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>)
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?
How I open the file:
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);
where file is an AudioFileID instvar and name and type are NSString * parameters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否可能用完文件句柄?使用完打开的文件后,您会关闭它们吗?
Is it possible that you are running out of file handles? Do you close the files you open after you are finished with them?