无法在CORDOVA插件中访问swift框架的数据成员

问题描述

我正在尝试通过iOS插件向我的CORDOVA项目添加一个快速框架。但是在插件的.m文件中,我无法从框架访问任何函数。它只是说Use of undeclared identifier。 以下是我的plugin.xml

<?xml version='1.0' encoding='utf-8'?>
<plugin
  id="cordova-plugin-appInvoke"
  version="0.1.0"
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
  xmlns:android="http://schemas.android.com/apk/res/android">
  <name>CustomPlugin</name>
  <js-module name="CustomPlugin" src="www/CustomPlugin.js"><
    clobbers target="cordova.plugins.CustomPlugin" />
  </js-module>
  <platform name="ios">
    <config-file parent="/*" target="config.xml">
      <feature name="CustomPlugin"><param name="ios-package" value="CustomPlugin" /></feature>
    </config-file>
    <source-file src="src/ios/CustomPlugin.m" />
    <framework src="src/ios/XYZ.framework" embed="true" custom="true"/>
  </platform>
</plugin> 

CustomPlugin.m如下:

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

@interface CustomPLugin : CDVPlugin {
  // Member variables go here.
}
@property (nonatomic,strong) CDVInvokedUrlCommand *command;
@property (nonatomic,strong) XYZClass *xyzClass;//this is present in the framework,and returning Use of undeclared identifier
// - (void)coolMethod:(CDVInvokedUrlCommand*)command;
@end

@implementation CustomPlugin
@end

我尝试访问的类已经用@objc标记并且可以被Objective-C访问。

当我将此插件添加到我的cordova项目中并为iOS构建它时,会出现上述错误。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...