OSStatus NSOSStatusErrorDomain

2019-04-06 23:24发布

问题:

I received the following error when I get the property using

AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,&size,
                                      &myAudioDescription.mSampleRate)

Error Produced by above statement is

Error Domain=NSOSStatusErrorDomain Code=560557673 "The operation couldn’t be completed. (OSStatus error 560557673.)"

Now, here what does 560557673 mean and where can I find its explanation?

Documentation only provides NSOSStatusErrorDomain as one of the errors.

回答1:

That code means the property data size was not correct.

OSStatus is a type commonly used for error codes in OS X and iOS. If the magnitude of the code is less than 1 million, then the code is probably listed in MacErrors.h in the CarbonCore framework. Otherwise, it is probably a four-character code listed in the same header as the function which returned it. You can find the header of a function by command-clicking it in Xcode. The codes will most likely be listed near the top, grouped together. To convert the number to a code, use the Calculator app in Developer view to convert it to hexadecimal and convert each byte to a character.