Build Error for org.apache.cordova.file on cli-6-0-0 and up on iOS

  • 1
  • Problem
  • Updated 4 years ago
Due to changes in CDVPlugin, when building for iOS using:
preference name="phonegap-version" value="cli-6.1.0"
gap:plugin name="org.apache.cordova.file"

The following build error is produced:
/Plugins/org.apache.cordova.file/CDVFile.m:322:29: error: no visible @interface for ‘CDVPlugin’ declares the selector ‘initWithWebView:’
self = (CDVFile*)[super initWithWebView:theWebView];
~~~~~ ^~~~~~~~~~~~~~~
1 error generated.

Currently using a less than ideal work-around:
platform name="android"
preference name="phonegap-version" value="cli-6.1.0"
platform
platform name="ios"
preference name="phonegap-version" value="cli-5.2.0"
platform

Any assistance or suggestions would be greatly appreciated!
Photo of Kyle

Kyle

  • 3 Posts
  • 0 Reply Likes
  • frustrated

Posted 4 years ago

  • 1
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
You can't use the old plugins that were deprecated a year ago. Use the latest version from npm.
Photo of Kyle

Kyle

  • 3 Posts
  • 0 Reply Likes
Have attempted with numerous versions and sources.

Reproducible with:
preference name="phonegap-version" value="cli-6.0.0"
gap:plugin name="org.apache.cordova.file" source="npm" version="4.2.0"

Plugin details:
https://www.npmjs.com/package/cordova...
stevegill published 2 weeks ago
4.2.0 is the latest of 20 releases

Error:
Plugins/org.apache.cordova.globalization/CDVGlobalization.m:26:38: error: no visible @interface for 'CDVPlugin' declares the selector 'initWithWebView:'
self = (CDVGlobalization*)[super initWithWebView:theWebView];
~~~~~ ^~~~~~~~~~~~~~~

Please let me know if I am not referencing the latest plugin correctly.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Well,
org.apache.cordova.file doesn't exist on npm. The name for the plugin is cordova-plugin-file

I would include this plugin (if at all necessary....do you have file-transfer as well?) this way:
<plugin name="cordova-plugin-file"/>

Otherwise, other posts about these messages might help:
https://www.google.de/search?q=no+vis...
Photo of Kyle

Kyle

  • 3 Posts
  • 0 Reply Likes
Thank you very much for your answer, and for recommending relying on file-transfer instead.

As a note, unfortunately:
plugin name="cordova-plugin-file"

Gives the same result:
CDVFile.m:322:29: error: no visible @interface for 'CDVPlugin' declares the selector 'initWithWebView:'
self = (CDVFile*)[super initWithWebView:theWebView];
~~~~~ ^~~~~~~~~~~~~~~

Those Google hits appear to be for other plugins that also required patching e.g.:
https://github.com/Wizcorp/phonegap-f...
https://github.com/shazron/KeychainPl...

I shall remove the dependency in favour of cordova-plugin-file-transfer.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Kyle,
Since this is your first posting, please answer the following questions.
- is this your first hybrid mobile app?
- are you using phonegap desktop app?
- Are you using CLI, Build or SDK? Please do not assume the answer. Please read the link.

Thanks
Jesse