[英]Import and use Google SignIn iOS SDK in a Swift Framework
I need to import Google/SignIn SDK
in a swift framework MySDK
which is used in MyApp
and I'm not quite sure how to do that. 我需要在
MyApp
使用的快速框架MySDK
导入Google/SignIn SDK
,我不太清楚如何做到这一点。 I use CocoaPods as a dependency manager. 我使用CocoaPods作为依赖管理器。
Here is some background: 这是一些背景:
If I wanted to use Google/SignIn
in the main MyApp
, I would need to include the following line in the MyApp-Bridging-Header.h
: 如果我想在主
MyApp
使用Google/SignIn
,我需要在MyApp-Bridging-Header.h
包含以下行:
#import <Google/SignIn.h>
That would allow me to import Google
in any swift file and use it, no problem. 这将允许我在任何swift文件中
import Google
并使用它,没问题。
Dynamic frameworks don't have bridging headers, so I tried to put in the umbrella header MySDK.h
. 动态框架没有桥接头,所以我试图把伞头
MySDK.h
。 However, this produces the following error: 但是,这会产生以下错误:
Include of non-modular header inside framework module 'MySDK'
Although not importing <Google/SignIn.h>
allows MySDK
to build successfully and use Google SDK throughout the framework, when I try to import MySDK
in MyApp
, I get the following error on the import MySDK
line: 虽然不导入
<Google/SignIn.h>
允许MySDK
成功构建并在整个框架中使用Google SDK,但当我尝试在MyApp
导入MySDK
时,我在import MySDK
行时收到以下错误:
MyApp/ViewController.swift:10:8: Missing required module 'Google'
What's interesting is that I have this problem only with Google SDK. 有趣的是,我只在Google SDK中遇到此问题。 All the other dependencies, like
Facebook LoginKit
work without any issues. 所有其他依赖项,如
Facebook LoginKit
工作没有任何问题。
https://github.com/tomaskraina/GoogleSDK-in-dynamic-framework https://github.com/tomaskraina/GoogleSDK-in-dynamic-framework
I was facing the same issue. 我面临同样的问题。 This may be a trick but it worked for me i explicitly installed Google/SignIn pod in my main project too, doing this provided the main project the dependency it was unable to locate and thus I was able to use my dynamic framework.
这可能是一个技巧,但它对我有用,我在我的主项目中明确安装了Google / SignIn pod,这样做为主项目提供了无法找到的依赖关系,因此我能够使用我的动态框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.