public
Last active

Decode OSStatus error codes into strings.

  • Download Gist
OSStatus.m
Objective-C
1 2 3 4 5 6 7 8
NSString *NSStringFromOSStatus(OSStatus errCode)
{
if (errCode == noErr)
return @"noErr";
char message[5] = {0};
*(UInt32*) message = CFSwapInt32HostToBig(errCode);
return [NSString stringWithCString:message encoding:NSASCIIStringEncoding];
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.