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

2 Likes

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!

Wow. I can’t believe this worked. This was my problem.

** BUILD FAILED **

The following build commands failed:
CompileC /Users/stephenmonro/Library/Developer/Xcode/DerivedData/AppName-dkgqzlaztjythbaawmdqxxnhjikl/Build/Intermediates.noindex/AppName.build/Release-iphonesimulator/AppName.build/Objects-normal/x86_64/CDVFileTransfer.o /Users/me/ionicApps/c4i2021/c4i2021/platforms/ios/AppName/Plugins/cordova-plugin-file-transfer/CDVFileTransfer.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Command finished with error code 65: xcodebuild -workspace,AppName.xcworkspace,-scheme,App Name,-configuration,Release,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 12 Pro Max,build,CONFIGURATION_BUILD_DIR=/Users/me/ionicApps/app/app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/me/ionicApps/app/app/platforms/ios/build/sharedpch
xcodebuild: Command failed with exit code 65
Error: xcodebuild: Command failed with exit code 65
at ChildProcess.whenDone (/Users/me/ionicApps/app/app/node_modules/cordova-common/src/superspawn.js:136:25)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
[ERROR] An error occurred while running subprocess cordova.

    cordova build ios --release --verbose exited with exit code 65.

    Re-running this command with the --verbose flag may provide more information.

ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 2 functions +0ms
ionic:utils-process processExit: exiting (exit code: 65) +36ms

Im trying to build my IOS App when i build i got this error

The following build commands failed:
CompileC /var/root/Library/Developer/Xcode/DerivedData/1GROCER-fjhxdipaxodpficqmfiamqjtnybm/Build/Intermediates.noindex/1GROCER.build/Debug-iphonesimulator/1GROCER.build/Objects-normal/x86_64/CDVWKInAppBrowser.o /Users/nj/Desktop/3.0.5/platforms/ios/1GROCER/Plugins/cordova-plugin-inappbrowser/CDVWKInAppBrowser.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65