SecCopyErrorMessageString gives “Use of unresolved identifier” in swift

前端 未结 3 332
遇见更好的自我
遇见更好的自我 2021-01-13 12:32

Trying to use SecCopyErrorMessageString to interpret errorCode. in swift :

    var result: OSStatus
    result = SecItemAdd(query as CFDictionary, nil);


          


        
相关标签:
3条回答
  • 2021-01-13 12:38

    The SecCopyErrorMessageString function only became available on iOS in version 11.3. Prior to that, it could only be used on OS X.

    0 讨论(0)
  • 2021-01-13 12:50

    It may not be obvious: This API is part of the Security framework. You need to add the framework to your project target's Build Phases > Link Binary With Libraries.

    0 讨论(0)
  • 2021-01-13 12:51

    The above answer is a bit outdated, according to Apple, iOS 11.3, tvOS 11.3 and watchOS 4.3 started to support this since the beta version of SDK.

    You'd need to compile against those supported SDKs to use that function. Otherwise, only macOS support that for now.

    0 讨论(0)
提交回复
热议问题