bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
568 stars 772 forks source link

Error when using PhoneGap Build Cloud #75

Closed keoir closed 6 years ago

keoir commented 7 years ago

I have been working all morning on getting this working, and need some help if anyone can lend a hand!

When you put the plugin into the config.xml and attempt to build it on PhoneGap Build it throws an error about the SWIFT needing a legacy version. Currently I am building with swift 3.0, what does this need? Or do I need to add a preference to make the plugin work?

barneydunning commented 7 years ago

I get this too... can anyone help?

smithmeisterUK commented 7 years ago

Me too:

=== BUILD TARGET QRScan OF PROJECT QRScan WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

BUILD FAILED

bitjson commented 7 years ago

Hey all – thanks for sharing. I don't have a good way of testing in that system, but I have a feeling it will be fixed by: https://github.com/bitpay/cordova-plugin-qrscanner/pull/81

Do you have a way of testing with that pull request?

fahadpathan commented 7 years ago

I have resolved it by using xcode 8.3.1

agrath commented 6 years ago

[edit: merged two comments into one]

I was commenting here: #41

But I have been also trying to build using build.phonegap.com the past couple of days. I've tried a few different things such as hinting at the swift version with <preference>

I also tried using the git master branch via <plugin spec="...git"/> but that gave a different error about not being able to find www.min.js which I have resolved as follows:

If I include via git, using this fork: https://github.com/armenbadalyan/cordova-plugin-qrscanner (which adds the www build files), then use this plugin include: <plugin spec="https://github.com/armenbadalyan/cordova-plugin-qrscanner.git" source="git" /> it will get past the pre-build tasks.

Unfortunately, it still throws with a swift error further in the build, sourcing direct from git, and I can confirm the fork has #81 included

Here is the build error -snip-

Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

** ARCHIVE FAILED **

The following build commands failed:
    Check dependencies
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/private/project/cordova/build-release.xcconfig,-workspace,BootTrack.xcworkspace,-scheme,BootTrack,-configuration,Release,-destination,generic/platform=iOS,-archivePath,BootTrack.xcarchive,archive,CONFIGURATION_BUILD_DIR=/private/project/build/device,SHARED_PRECOMPS_DIR=/private/project/build/sharedpch

I have also tried hinting the swift version 3.0 (which should be the default) with this in config.xml

  <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <preference name="swift-version" value="3.0" />
    <preference name="UseLegacySwiftLanguageVersion" value="true" />
  </platform>

Full log from my build here: log.txt

agrath commented 6 years ago

This appears to be a problem with xcode needing the swift version specified during the build. When you're building with build.phonegap the pbxproj file is not accessible.

https://github.com/ionic-team/ionic-native/issues/620 seems to have a way more technical writeup on how to fix the project file by hand, but that's not an option for build.phonegap.com as you can't edit that file directly.

I am pretty sure this is what <preference name="swift-version" ... /> is meant to be doing but it doesn't seem to be working?

I have forked the https://github.com/armenbadalyan/cordova-plugin-qrscanner.git and in plugins.xml changed the <dependency id="cordova-plugin-swift-support" spec="~3.1.1" /> to <dependency id="cordova-plugin-swift-support" spec="3.0.0" /> as build.phonegap only supports swift 3.0 but this had no effect.

I have also tried many different combinations of <preference name="swift-version" ... />

Early on, when I was updating via #41 I also tried swift-version 2.3 and the NPM sourced package

braidiano commented 6 years ago

Same problem here. Any solution? I compile using Visual Studio and remotebuild on Mac (XCode 8.3.3)

agrath commented 6 years ago

Hi all, I have had a reply on the Adobe community forums. Phonegap build does not support cordova hooks, and cordova-plugin-swift-support is a cordova hook - so this is what is causing the issue here. I wonder if we need this at all for phonegap build as it has it's own mechanism for setting the swift version? Can someone from the project team weigh in as I am not familar enough with xcode or swift to know what cordova-plugin-swift-support does.

bitjson commented 6 years ago

This has been quite for a while, so I'm going to close it. Feel free to open a new issue if you're still having trouble.