[
https://issues.apache.org/jira/browse/CB-12864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16029997#comment-16029997
]
Kerri Shotts commented on CB-12864:
-----------------------------------
You say "the following fragment", but I don't see any additional snippet. Did
you mean to include something extra?
There shouldn't be any restriction on the name of the plugin needing to match
the name of the subclass. What is required is that the value for
{{ios-package}} and the name of the subclass match (this is the only way
Cordova can find the native code) (which is documented here:
https://cordova.apache.org/docs/en/latest/guide/platforms/ios/plugin.html#plugin-class-mapping)
Cordova maps from your JS code to the native code using the {{feature}} name
(in your case, "AWS") and the class name (derived from the {{ios-package}} tag,
in your case "AWSPlugin"). Your {{cordova.exec}} would look like this:
{code}
cordova.exec(win, fail, "AWS", "someMethod", args);
{code}
This gets (roughly) translated to
{code}
AWSPlugin* awsPlugin = [[AWSPlugin alloc] initWithWebViewEngine:webview];
CDVInvokedCommandUrl* command = [CDVInvokedCommandUrl initWithArguments:args
...];
[awsPlugin someMethod:command];
{code}
... where "AWS" (the feature) leads to {{AWSPlugin}} (the class, specified by
{{ios-package}}). If the class doesn't match {{ios-package}}, Cordova will
encounter an error when trying to instantiate the plugin, because the class it
will try to use doesn't exist.
Now, if everything you tried was in line with the above, and yet Cordova
couldn't find the plugin, please link to a gist or repo of an example project
that duplicates the issue you encountered, so that we can try to duplicate it.
> Plugin 'xxxxx' is not found, or is not a CDVPlugin
> --------------------------------------------------
>
> Key: CB-12864
> URL: https://issues.apache.org/jira/browse/CB-12864
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-ios
> Affects Versions: [email protected]
> Environment: Xcode 8.3.2 and cordova iOS 4.4.0
> Reporter: Gary N Griswold
>
> I wrote a plugin in which the name of the plugin and the name of the
> www/XXX.js file were the same, but I named the name of the CDVPlugin subclass
> a different name. Doing this caused the error that the linker did not
> include the CDVPlugin subclass. The error was "Plugin 'xxxxx' is not found,
> or is not a CDVPlugin"
> The problem was fixed by changing the name of the CDVPlugin subclass to the
> same name as the Plugin and the www/XXX.js file.
> The following are relevant fragments from the plugin.xml file:
> <name>AWS</name>
> <js-module name="AWS" src="www/AWS.js">
> <clobbers target="AWS" />
> </js-module>
> <platform name="ios">
> <config-file target="config.xml" parent="/*">
> <feature name="AWS">
> <param name="ios-package" value="AWSPlugin" />
> </feature>
> </config-file>
> <source-file src="src/ios/AWSPlugin.swift" />
> </platform>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]