cordova-plugin-file
cordova-plugin-file copied to clipboard
XCode build fails: Redefinition of enumerator 'SYNTAX_ERR
Bug Report
XCode build fails: Redefinition of enumerator 'SYNTAX_ERR
Problem
The error started to appear when I added the below cordova plugins to the project where cordova-sqlite-storage plugin already existed:
- cordova-plugin-file
- cordova-plugin-qrscanner
What is expected to happen?
Build should not break.
What does actually happen?
Xcode build fails
Information
The cordova-sqlite-storage plugin has WebSQLError enum with SYNTAX_ERR = 5 and cordova-plugin-file plugin has CDVFileError enum with SYNTAX_ERR = 8. It seems to be the problem with the same name for these enums.
Command or Code
N/A
Environment, Platform, Device
See ionic info output
Ionic:
ionic (Ionic CLI) : 4.10.3 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.4.0
@angular-devkit/build-angular : 0.12.3
@angular-devkit/schematics : 7.2.3
@angular/cli : 7.2.3
@ionic/angular-toolkit : 1.2.3
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.24
@capacitor/core : 1.0.0-beta.24
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
System:
Android SDK Tools : 26.1.1 (/Users/alexryltsov/Library/Android/sdk/)
NodeJS : v10.14.2 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/bin/node)
npm : 6.5.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
Version information
See above
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
ping @brodybits
Linking to xpbrew/cordova-sqlite-storage#868, which is marked as a bug. I would like to resolve this problem on the cordova-sqlite-storage side. (I will probably need a few weeks to look into this one.)
The SYNTAX_ERR enumerator seems to have been defined on both plugins for several years. So I find it pretty strange that this problem would suddenly appear after multiple years. I wonder if it has anything to do with an Xcode update or any other framework updates?
https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/ios/CDVFile.h#L26-L40 I don't even know why this is clashing with yours...
I solved it by simply removing and adding the plugin again.
Some plugins, e.g. file-transfer and zip, will cause this problem. After installing those plugins, removing file plugin with
cordova plugin rm cordova-plugin-file --force and then add it with cordova plugin add cordova-plugin-file will fix the problem.