Error in iOS Build with cordova-plugins

I’m trying to build my app with the latest cordova-ios version 6.1.1 to include the latest status-bar plugin to overcome the issue where the status bar overlays the cordova app after returning from the camera, however I am getting a build error due to what appears to be old plugin code for the file transfer plugin:

[12:34:24]: ▸ Compiling CDVFileTransfer.m
[12:34:24]: ▸ :warning: /Users/ionic/builds/schlackl/MyFieldApp/platforms/ios/My Field App/Plugins/cordova-plugin-file-transfer/CDVFileTransfer.m:98:36: ‘stringByAddingPercentEscapesUsingEncoding:’ is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. [-Wdeprecated-declarations]
[12:34:24]: ▸ pathComponent = [pathComponent stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[12:34:24]: ▸ ^
[12:34:24]: ▸ :x: /Users/ionic/builds/schlackl/MyFieldApp/platforms/ios/My Field App/Plugins/cordova-plugin-file-transfer/CDVFileTransfer.m:107:49: no known instance method for selector ‘userAgent’
[12:34:24]: ▸ NSString* userAgent = [self.commandDelegate userAgent];

I have found posts online stating this issue was fixed in a plugin update however I am not sure how to force appflow to use the latest plugin version during the build.

I’ve tried with latest build stack in AppFlow:
| Node.js version | v12.18.3 |
| Cordova CLI version | 10.0.0 |
| npm version | 6.14.6 |
| macOS version | 10.15.6 |
| Xcode version | Xcode 12.0 |

However, no luck as I get the same build error regardless of what build stack I use. Any thoughts on how to ensure the latest plugins are fetched and used for my build? Can I force this in config.xml perhaps?

Hi there,

Appflow will use the versions of your plugins that are specified in your package.json and config.xml (for Cordova). To make sure you are using the latest, check those files and ensure they are pointing to the latest version numbers of the plugin.

Hope that helps!

cordova-plugin-file-transfer has been updated to support cordova-ios 6, but it has not been released yet, so you can only install it from github.
run

cordova plugin rm cordova-plugin-file-transfer
cordova plugin add https://github.com/apache/cordova-plugin-file-transfer

note that this is NOT recommended as you would be using a development version of the plugin and things could break

1 Like

Hi there - thanks for this response - in the end I was able to remove that plugin as I’m not using it however the issue I’m really facing is in the statusbar plugin - it loses its overlay state after returning from the camera app even though the plugin docs suggest this issue was fixed in the latest version of the plugin however it still behaves the same for me and overlays my app after returning from the camera. Would love to know how to resolve this issue…holding me back on my next version release :wink:

It’s the same, the plugin fixed but there wasn’t a npm release, so you can install from github

OK but how will Ionic Appflow know to pull that plugin from GitHub when I build from my latest commit? My plugins are not included in my project source, they are references in my config.xml file and are pulled via npm. How do I specify a github location for my plugin?
And based on your previous comment about best practice, it seems odd that the plugin was fixed but not released in npm - doesn’t that mean I’d be using a development version of the plugin?
Thanks again for all your comments - trying to understand :wink:

npm can install from github urls, if you install the plugin using the github url, the config.xml will point to github instead of to the latest version

And yeah, you would be using the development version, that’s why I said it’s not really recommended.

Thanks for the tip - in the end I found a manual “work-around” for my issue - it’s silly but it works…I just hide() and then show() the statusbar after returning from the camera - works like a charm and I can just use the distributed plugin from NPM so that makes me happier!