无法在 Swift 框架中导入 Common Crypto [英] Cannot import Common Crypto in a Swift framework

查看:27
本文介绍了无法在 Swift 框架中导入 Common Crypto的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Xcode 中,当我尝试通过 Swift 框架中的桥接头文件(使用 #import )添加 Objective C 库 Common Crypto 时,我得到一个错误说当目标是框架时不允许桥接头.

In Xcode, when I try to add the Objective C library Common Crypto via a bridging header file in a Swift framework (using #import <CommonCrypto/CommonCrypto.h>), I get an error saying that bridging headers aren't allowed when target is framework.

当我将其添加到伞头文件中时,出现此错误:Include of non-modular header inside framework module"

When I add it to the umbrella header file, I get this error: "Include of non-modular header inside framework module"

此链接似乎涉及相同的问题:在 Swift 框架中导入 CommonCrypto

This link seems to the about the same problem: Importing CommonCrypto in a Swift framework

但是那里的解决方案非常复杂,并且对于仅将 Objective C 库包含到框架中来说似乎太多了.还有一些关于在对 Xcode 和 iOS 进行一些更新后解决方案不起作用的评论.解决问题的最佳方法是什么?(该网站不允许我对上述链接发表评论;所以我不得不在此处将其作为单独的问题发布.)

But the solutions there are very complex and seem to be too much for just including an Objective C library into a framework. Also there are some comments about the solution not working after some updates to Xcode and iOS. What is the best way to solve the issue? (The website would not let me comment on the above-mentioned link; so I had to post it as a separate question here.)

推荐答案

#import <CommonCrypto/CommonDigest.h>

在桥接头中对我有用.

这篇关于无法在 Swift 框架中导入 Common Crypto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆