ios 什么是操作系统状态?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21064696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is OSStatus?
提问by user2553675
For example:
例如:
OSStatus AudioServicesCreateSystemSoundID (
CFURLRef inFileURL,
SystemSoundID *outSystemSoundID
);
In the Apple's documentation description of this function tells us that the returned value is a "result code". But what code? Why is it "OSStatus"?
在 Apple 的文档中对这个函数的描述告诉我们返回的值是一个“结果代码”。但是什么代码?为什么是“OSStatus”?
回答by Abizern
As you've said, it's the result code of the function.
正如你所说,它是函数的结果代码。
Hovewer, different functions have different result codes that you can handle as you wish. for example, for Audio services, the current OSStatus codes are give in the documentationas:
但是,不同的函数有不同的结果代码,您可以随意处理。例如,对于音频服务,当前的 OSStatus 代码在文档中给出:
So as you call your functions, you check the returnes OSStatus
and if it's noErr
(which is what 0
is), then you can continue with your next call, otherwise you handle the error accordingly.
所以当你调用你的函数时,你检查返回值OSStatus
,如果它是noErr
(这是什么0
),那么你可以继续你的下一个调用,否则你相应地处理错误。