如何解决无法在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 举报,一经查实,本站将立刻删除。