gpt4 book ai didi

ios - Cordova Swift 插件 : Use of undeclared type 'CDVPlugin'

转载 作者:行者123 更新时间:2023-11-30 11:16:43 24 4
gpt4 key购买 nike

编辑:没关系。答案是:不要进口任何东西,因为它在全局范围内公开。我认为这与桥接 header 有关,但这非常令人困惑。

<小时/>

我正在尝试用 Swift 编写一个自定义 Cordova 插件,但我找到的所有信息都不完整或过时。在 swift 文件中导入 CDVPlugin 的正确方法是什么?

这就是我正在尝试的:

import CDVPlugin

但是 xcode 只是说没有这样的模块“CDVPlugin”Cordova's iOS plugin docs更不用说使用 swift 了。

我有两个桥接头文件(不知道为什么)Bridging-Header.hAppName-Bridging-Header.h。在“build设置”下,看起来正在使用 AppName-Bridging-Header.h 。我尝试将其添加到两者中,但没有帮助:

#import <Cordova/CDV.h>
#import <Cordova/CDVPlugin.h>

我应该如何向我的 swift 文件公开 CDVPlugin 类?

最佳答案

解决方案是从我的 swift 文件中删除 import ,因为显然桥接 header 将全局公开这些类。

关于ios - Cordova Swift 插件 : Use of undeclared type 'CDVPlugin' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51677617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com