我尝试将 RNCryptor 导入我的项目以加密一些字符串。但是我很难理解如何将它导入到我的objective-c项目中。我通过拖放复制了 RNCryptor/RNCryptor.swift 和 RNCryptor.h 到我的项目中。然后它“创建了一个桥接头”。之后我尝试调试,但出现 38 条错误消息,例如:Use of unresolved identifier 'kCCKeySizeAES256' 或 Use of unresolved identifier 'CCPBKDFAlgorithm' 。我该如何解决这个问题以及如何在 viewController.h 文件中使用它?通常使用 #import "RNCryptor.h"
https://github.com/RNCryptor/RNCryptor#obj-c
Best Answer-推荐答案 strong>
我认为您需要将 #import "RNCryptor/RNCryptor.h" 添加到桥接头文件中,您这样做了吗?
见 RNCryptor Swift branch
The Bridging Header
CommonCrypto is not a modular header in Xcode 7. This makes it very challenging to import into Swift. To work around this, the necessary header files have been copied into RNCryptor.h, which needs to be bridged into Swift. You can do this either by using RNCryptor as a framework, adding #import "RNCryptor/RNCryptor.h" to your existing bridging header, or making RNCryptor/RNCryptor.h your bridging header in Build Settings, "Objective-C Bridging Header."
关于ios - 将 RNCryptor 导入项目,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/34249377/
|