问题描述
我在导入 CommonCrypto / CommonCrypto
或 CommonCrypto / CommonDigest
时遇到问题。我的 Swift
代码需要一个SHA256。
I have a problem with importing CommonCrypto/CommonCrypto
or CommonCrypto/CommonDigest
. I need a SHA256 for my Swift
code.
我发现 CommonCrypto
Cocoapods的github网站。
I found CommonCrypto
github site in Cocoapods.
所以我从上面下载了文件。
但我收到有关 ARC
的错误(我已经像其他教程那样添加了Bridging-Header。)
头文件的名称是 NSData + CommonCrypto.h
和 NSData + CommonCrypto.m
。
这不是 CommonCrypto / CommonCrypto
或 CommonCrypto / CommonDigest
我在哪里可以下载并获取确切的文件 SHA256的CommonCrypto
?
So I have downloaded the file from above.But I'm getting errors about ARC
(I have added Bridging-Header like other tutorials do.)
The header file's name is NSData+CommonCrypto.h
and NSData+CommonCrypto.m
.
It's not a CommonCrypto/CommonCrypto
or CommonCrypto/CommonDigest
Where can I download and get the exact file CommonCrypto
for SHA256?
推荐答案
无需其他文件。你需要一个首先,您已经拥有,但对于那些没有最简单的方法来实现这一目标的人是将Objective-C文件添加到您的项目中并接受它何时提供创建一个桥接头。然后,您可以将整个CommonCrypto导入(感谢@zaph - 请参阅注释)到桥接标题:
No additional files are required. You need a bridging header first of all, which you already have but for those who don't the easiest way to achieve this is to add an Objective-C file to your project and to accept when it offers to create a bridging header. You can then either import the whole of CommonCrypto (thanks @zaph - see comments) to the bridging header:
#import <CommonCrypto/CommonCrypto.h>
或组成部分:
#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
#import <CommonCrypto/CommonKeyDerivation.h>
#import <CommonCrypto/CommonSymmetricKeywrap.h>
您现在可以在Swift中使用CommonCrypto。例如,代码。
You can now use CommonCrypto in Swift. For example code see here.
这篇关于我在哪里可以获得CommonCrypto / CommonCrypto文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!