相关疑难解决方法(0)

iOS:在哪里可以找到iOS的OSStatus代码的完整列表?

我可以noErr = 0在OS X库中轻松找到源代码.但是很难OSStatus在iOS上找到完整的错误代码列表.

在Mac OS X上,找到类似的东西并不难

kAudioHardwareUnsupportedOperationError
Run Code Online (Sandbox Code Playgroud)

但我似乎无法找到iOS OSStatus代码的有用信息.有一个完整的列表或任何指向定义它们的头文件的指针会很好.

谢谢!

更新:

我不认为我的问题与上述问题重复."可能重复"问题的操作想要将他已经知道的4-char代码转换为人类可读的字符串.相反,这是我的进一步规范:

我甚至不知道用于iOS的4-char或typedefed整数.我希望看到类似完整代码列表的内容,就像您在许多C++框架/库设计中通常会看到的那样,例如枚举列表,标准异常,甚至是OSX k-something代码,至少可以可以单独在Xcode文档中找到.

我对这些代码的使用包括:

在我的自定义函数中,例如,一些必须返回OSStatus的CoreAudio回调,我想返回这些内置的人类可读代码来指示运行时错误的类型.没有列表,除了noErr之外,我不知道该返回什么.

显然,许多OSX k代码在iOS环境下是未定义的,因此它们不能透明地使用.

更新(结论):

我终于找到了一个线索:在Xcode文档(管理器)中搜索关键字"结果代码",我们在"系统指南"结果中获得或多或少的归类返回代码文档部分.这对我原来的问题来说已经足够了. -

error-handling cocoa ios

20
推荐指数
1
解决办法
3万
查看次数

iOS - 播放录制的音频失败,OSStatus错误-43(找不到文件)

当我的视图加载时,我按以下方式设置AVAudioRecorder实例:

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
audioSession.delegate = self;
[audioSession setActive:YES error:nil];
[audioSession setCategory:AVAudioSessionCategoryRecord error:nil];

NSString *tempDir = NSTemporaryDirectory();
NSString *soundFilePath = [tempDir stringByAppendingPathComponent:@"sound.m4a"];

NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
NSLog(@"%@", soundFileURL);

NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                [NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
                                [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
                                [NSNumber numberWithInt:16], AVEncoderBitRateKey,
                                [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
                                [NSNumber numberWithFloat:8000.0], AVSampleRateKey,
                                [NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
                                nil];

NSError *error = nil;

self.recorder = [[AVAudioRecorder alloc]
                 initWithURL:soundFileURL
                 settings:recordSettings
                 error:&error];
self.recorder.delegate = self;

if (error) {
    NSLog(@"error: %@", [error localizedDescription]);
} else { …
Run Code Online (Sandbox Code Playgroud)

core-audio avfoundation avaudioplayer avaudiorecorder ios

5
推荐指数
1
解决办法
6442
查看次数