24

I can easily find noErr = 0 in the OS X library source code. But it's pretty hard to find a full list of error code for OSStatus on iOS.

On Mac OS X, it's not that hard to find stuff like

kAudioHardwareUnsupportedOperationError

But I can't seem to find useful info for iOS OSStatus codes. It would be nice to have a full list of them or any pointers to the header files that define them.

Thanks!

UPDATE:

I don't think my question is a duplicate of the above question. The op of that "possible duplicate" question wanted to convert the 4-char codes he already knew into human-readable strings. Instead, here is my further spec:

I don't even know what 4-char or typedefed integers to use for iOS. I'd like to see something like a full list of codes, like you would normally see in many C++ framework/library design, e.g., an enum list, or standard exceptions, or even the OSX k-something codes, which at least can be found in the Xcode docs alone.

My usecases of these codes include:

In my custom functions, e.g., some CoreAudio callbacks that have to return OSStatus, I'd like to return these built-in human-readable codes to indicate the types of runtime errors. Without the list, I don't know what to return, other than noErr.

Apparently, many OSX k-codes are undefined under iOS environment so they can't be used transparently.

UPDATE (CONCLUSION):

I finally found a clue: Search for keyword "Result Codes" in Xcode documentation (Organizer) and we get more or less categorized return codes documentation sections in the "System Guides" result. This is good enough for my original question. –

kakyo
  • 10,460
  • 14
  • 76
  • 140
  • 1
    I don't think there is a full list; I believe it depends on the API being used when it should be documented with the function. – trojanfoe Jun 03 '13 at 21:33
  • It's a nasty mess, and I don't think there's any single piece of documentation for it - at least if there is, I've never been able to find one. Searching headers files it will have to be. – marko Jun 03 '13 at 22:07
  • 1
    I finally found a clue: Search for keyword "Result Codes" in Xcode documentation (Organizer) and we get a more or less categorized return codes documentation sections in the "System Guides" result. This is good enough for my original question. – kakyo Jun 26 '13 at 18:37
  • Indeed, @kakyo, searching for the error code in Organizer worked for me. Shame on me for trying Google first, though it did lead me here. ;) – Randall Cook Oct 07 '13 at 07:36
  • 5
    http://www.osstatus.com found a few random ones for me – gadu Aug 29 '15 at 17:36

1 Answers1

12

The best I can do to help is provide the results of using find from the command line:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
$ find . -name \*.h -exec fgrep -l OSStatus {} \;
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFile.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFileStream.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFormat.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioServices.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioSession.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/MusicPlayer.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioComponent.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioOutputUnit.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnitProperties.h
./System/Library/Frameworks/AudioUnit.framework/Headers/MusicDevice.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMAudioClock.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBase.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBlockBuffer.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBufferQueue.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSampleBuffer.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSimpleQueue.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSync.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIDriver.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIServices.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDISetup.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIThruConnection.h
./System/Library/Frameworks/Foundation.framework/Headers/NSError.h
./System/Library/Frameworks/MediaToolbox.framework/Headers/MTAudioProcessingTap.h
./System/Library/Frameworks/Security.framework/Headers/SecBase.h
./System/Library/Frameworks/Security.framework/Headers/SecIdentity.h
./System/Library/Frameworks/Security.framework/Headers/SecImportExport.h
./System/Library/Frameworks/Security.framework/Headers/SecItem.h
./System/Library/Frameworks/Security.framework/Headers/SecKey.h
./System/Library/Frameworks/Security.framework/Headers/SecTrust.h
./System/Library/Frameworks/Security.framework/Headers/SecureTransport.h
./usr/include/AssertMacros.h
./usr/include/Endian.h
./usr/include/MacTypes.h
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Thanks trojanfoe. That seems to be a (painful) workaround. I'll use this one for now. It's so sad that Apple still hasn't got the error codes sorted out in their docs. – kakyo Jun 04 '13 at 22:00
  • interesting enough, I just got error -25243 which does NOT appear in any .h file, verified with: find . -name \*.h | xargs grep 25243 – Sagi Mann Oct 13 '13 at 12:19
  • –25243 = errSecNoAccessForItem, which is in Mac headers/documentation but not iOS. https://developer.apple.com/library/mac/documentation/security/Reference/keychainservices/Reference/reference.html – jrc Oct 27 '13 at 21:32
  • 16
    For Security framework errors, you can use the `security` command like so: `security error -25243`. Output: `Error: 0xFFFFFFCE -50 One or more parameters passed to a function were not valid.` – jrc Oct 27 '13 at 21:51
  • 4
    I love the way Apple write documentations. I am convinced they hate developers. It is so obvious. Every piece of documentation is incomplete, vague and poorly written. – Duck Dec 17 '16 at 19:25
  • I wonder how could the documentation writers could possibly keep up with developers in cupertino as the marketing onslaught of features to keep up with droid joneses runs over flying soccer engineering? Compared to the man pages I've had on linux Apple documentation is a huge leap forward. Not that I read it often myself :^) And no, I do not work for apple. – Anton Tropashko Jan 04 '17 at 10:35