How do you convert an iPhone OSStatus code to something useful?

前端 未结 19 1601
执念已碎
执念已碎 2020-12-05 01:45

I am getting more than a little sick of this iPhone SDK and its documentation...

I am calling AudioConverterNew

in the documentation under Returns: it says \

19条回答
  •  感动是毒
    2020-12-05 02:05

    for Security framework on IOS given that SecCopyErrorMessageString is missing on the platform it's DYI

    add error codes at the bottom of

    https://developer.apple.com/library/ios/documentation/Security/Reference/keychainservices

    to your very own switch.

    for example

            let status : OSStatus = SecItemAdd(query as CFDictionaryRef, nil)
            switch status {
            case errSecSuccess:
                return nil
            case errSecAuthFailed:
                // that's the result of dumping kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly into the query
                return "changing app lock type on a device without fingerprint and/or passcode setup is not allowed".localized
            default:
                return "unhandled case: implement this"
            }
    

提交回复
热议问题