Reputation: 123
I have a PhoneGap app and I'm using the plugin cordova-plugin-qrscanner
My config.xml file includes:
<plugin name="cordova-plugin-qrscanner" source="npm" spec="~3.0.1" />
I'm building the app using PhoneGap cloud build (https://build.phonegap.com)
On Android the build it is successful and the app is working with no issues
On iOS I'm receiving an error
Check dependencies
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Error: xcodebuild: Command failed with exit code 65
at ChildProcess.whenDone (/private/project/cordova/node_modules/cordova-common/src/superspawn.js:135:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
I already tried to add swift support plugin
<plugin name="cordova-plugin-add-swift-support" source="npm" spec="~2.0.2" />
and indicate the swift version as follows
<preference name="swift-version" value="3.0" />
<preference name="UseSwiftLanguageVersion" value="3" />
But still, no luck and I can't get it to work
Any suggestions ?
Upvotes: 4
Views: 2246
Reputation: 123
I found a solution I'm posting here for anyone who has the same
add Plugin
<plugin name="cordova-plugin-qrscanner" source="npm" spec="~3.0.1" />
I changed the swift-version to 4.2
<preference name="UseSwiftLanguageVersion" value="4" />
<preference name="SwiftVersion" value="4.2" />
I added swift-support hook using this line
<hook type="after_platform_add" src="plugins/cordova-plugin-qrscanner/scripts/swift-support.js" />
and one last fix is inside the iOS 'QRScanner.swift' (Path: src/ios/QRScanner.swift)
change "string: UIApplication.openSettingsURLString" to "string: UIApplicationOpenSettingsURLString" in openSettings function. line 470
Upvotes: 1