我尝试将 RNCryptor 导入到我的项目中以加密某些字符串。但我很难理解如何将其导入到我的 Objective-C 项目中。我通过拖放到我的项目中来复制 RNCryptor/RNCryptor.swift
和 RNCryptor.h
。然后它“创建了一个桥接头”。之后我尝试调试,但收到 38 条错误消息,例如:使用无法解析的标识符“kCCKeySizeAES256”
或 使用无法解析的标识符“CCPBKDFAlgorithm”
。我该如何解决这个问题以及如何在 viewController.h 文件中使用它?通常使用#import "RNCryptor.h"
最佳答案
我认为您需要将 #import "RNCryptor/RNCryptor.h"
添加到桥接头文件中,您这样做了吗?
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/