55
Views
9
Comments
[Camera Plugin] Swift Language Version not compatible
Camera Plugin
Forge asset by OutSystems
Application Type
Mobile

Hi I tried extending the OSCamera Plugin for ODC and am now getting this error when trying to generate the mobile package. I am trying to extend it to allow me to set a flash preference when the camera opens inside the app on iOS devices. 

There was an issue generating the app. The Cordova plugin cordova-plugin-camera is not compatible with the "Swift Language Version" build setting that was defined. Check your plugin configurations and try again. (OS-MABS-GEN-40014)

I'll attach the oml of the extension below. I can't attach the error build log, but I'll paste as much of the error as I can see.


[2024-09-19T17:03:27.151Z] [ERROR] [Build] Reason: There was an issue generating the app. The Cordova plugin cordova-plugin-camera is not compatible with the "Swift Language Version" build setting that was defined. Check your plugin configurations and try again.

[2024-09-19T17:03:27.151Z] [ERROR] [Build] Additional information:

[2024-09-19T17:03:27.151Z] [ERROR] [Build] [!] The `Servizio Patrol [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Servizio Patrol/Pods-Servizio Patrol.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[2024-09-19T17:03:27.151Z] [ERROR] [Build] [!] The `Servizio Patrol [Debug]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Servizio Patrol/Pods-Servizio Patrol.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[2024-09-19T17:03:27.151Z] [ERROR] [Build] [!] The `Servizio Patrol [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Servizio Patrol/Pods-Servizio Patrol.release.xcconfig'. This can lead to problems with the CocoaPods installation

[2024-09-19T17:03:27.151Z] [ERROR] [Build] [!] The `Servizio Patrol [Release]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Servizio Patrol/Pods-Servizio Patrol.release.xcconfig'. This can lead to problems with the CocoaPods installation

[2024-09-19T17:03:27.151Z] [ERROR] [Build] .swift:36:24: error:

[2024-09-19T17:03:27.151Z] [ERROR] [Build] /Plugins/cordova-plugin-camera/OSCAMRTakePictureParameters.swift:36:24: error:

[2024-09-19T17:03:27.151Z] [ERROR] [Build] .swift:42:21: error:

[2024-09-19T17:03:27.151Z] [ERROR] [Build] /Plugins/cordova-plugin-camera/OSCAMRTakePictureParameters.swift:42:21: error:

[2024-09-19T17:03:27.151Z] [ERROR] [Build] ** ARCHIVE FAILED **

[2024-09-19T17:03:27.151Z] [ERROR] [Build] The following build commands failed:

[2024-09-19T17:03:27.151Z] [ERROR] [Build]     SwiftCompile normal arm64 Compiling\ OSCAMRTakePictureParameters.swift source/platforms/ios/Servizio\ Patrol/Plugins/cordova-plugin-camera/OSCAMRTakePictureParameters.swift (in target 'Servizio Patrol' from project 'Servizio Patrol')

[2024-09-19T17:03:27.151Z] [ERROR] [Build]     SwiftCompile normal arm64 source/platforms/ios/Servizio\ Patrol/Plugins/cordova-plugin-camera/OSCAMRTakePictureParameters.swift (in target 'Servizio Patrol' from project 'Servizio Patrol')

[2024-09-19T17:03:27.151Z] [ERROR] [Build]     SwiftCompile normal arm64 Compiling\ OSCAMRPlayVideoParameters.swift source/platforms/ios/Servizio\ Patrol/Plugins/cordova-plugin-camera/OSCAMRPlayVideoParameters.swift (in target 'Servizio Patrol' from project 'Servizio Patrol')

[2024-09-19T17:03:27.151Z] [ERROR] [Build] (3 failures)

[2024-09-19T17:03:27.151Z] [ERROR] [Build] Command failed with exit code 65: xcodebuild -workspace Servizio Patrol.xcworkspace -scheme Servizio Patrol -configuration Debug -destination generic/platform=iOS -archivePath Servizio Patrol.xcarchive archive OTHER_CODE_SIGN_FLAGS=--options runtime --keychain "keys/keychain.keychain-db"

[2024-09-19T17:03:27.151Z] [ERROR] [Build] -- ^ --

[2024-09-19T17:03:27.151Z] [INFO] [Build] Application was not successfully generated!

[2024-09-19T17:03:41.876Z] [INFO] [Build] Execution time: 168170 ms


ExtendedCamera.oml
2023-01-19 12-23-07
Abhinav Shilwant

Hi @Spencer Buhler,

The error messages indicate that the Cordova plugin cordova-plugin-camera is not compatible with the Swift language version specified in your OutSystems mobile application. The issue arises during the build process, particularly around Swift-related settings in Xcode that the Cordova plugin cannot accommodate.

Here’s a step-by-step guide to potentially resolve this issue:

  1. Check Swift Version Compatibility: Ensure that the Swift version set in your OutSystems environment and the one required by cordova-plugin-camera are compatible. You might need to adjust the Swift version in the Xcode build settings.
  2. Review Plugin Settings: In the Service Studio, review the plugin’s settings to ensure that it is configured correctly to work with Swift. This may involve setting specific parameters that the plugin can accept or modifying the plugin’s source code to support the current Swift version.
  3. Update or Modify the Plugin: If the version of the plugin you are using does not support the necessary Swift version, you may need to:
    • Update to a newer version of the plugin if available that supports the required Swift version.
    • Modify the plugin’s source code to make it compatible with the Swift version used in your project.
  4. Cordova and iOS Platform Compatibility: Ensure that the versions of Cordova and the iOS platform you are using in your project are compatible with each other and with the plugin. Sometimes, discrepancies in these versions can cause build issues.
  5. Clean Build and Cache: Before attempting to build again, clean the build directory and clear any caches that Xcode or OutSystems might use. This can resolve issues caused by stale data.
  6. Consult OutSystems Documentation and Community: Check OutSystems documentation for any known issues or tips regarding the use of Cordova plugins with iOS/Swift. The OutSystems community forums can also be a helpful resource for advice from other developers who might have faced similar issues.
  7. Fallback to a Different Plugin: If you continue to face compatibility issues, consider looking for an alternative camera plugin that supports the required Swift version or has better compatibility with OutSystems.

If these steps do not resolve the issue, you may need to post more details about your configuration and the exact steps you have taken so far in the OutSystems community forum to receive more specific guidance.

2024-09-17 12-24-07
Rammurthy Naidu Boddu
Champion

Hi @Spencer Buhler

In plugin's most of the time the versioning problem occurred. Please check the version of the code and check working information in the cordova.  

UserImage.jpg
Ricardo Silva

Hey @Spencer Buhler,

Are you inserting the `cordova-plugin-add-swift-support` plugin into your app directly or through a custom plugin? What's happening is that the Camera plugin is expecting this plugin with a specific version, but there's another plugin introducing another, and clashing, version.

BR.

UserImage.jpg
Spencer Buhler

The problem was some code in the swift files that I changed. It's fixed now and builds successfully, but I still can't get the flash to be off on default even with the swift code not causing a build failure. I can get the function I want by just extending cordova's camera plugin, but I want to extend Outsystems plugin because of all the features it has and it will be easier for me to maintain and keep up to date with their updates. 

UserImage.jpg
Spencer Buhler

The problem was some code in the swift files that I changed. It's fixed now and builds successfully, but I still can't get the flash to be off on default even with the swift code not causing a build failure. I can get the function I want by just extending cordova's camera plugin, but I want to extend Outsystems plugin because of all the features it has and it will be easier for me to maintain and keep up to date with their updates. 

Screen Shot 2024-09-23 at 10.40.20 AM.png
Screen Shot 2024-09-23 at 10.40.58 AM.png
UserImage.jpg
Ricardo Silva

The plugin does not use the camera you're setting the flash. The plugin uses `UIImagePickerController`.

UserImage.jpg
Spencer Buhler


So would this self.viewController be the instance of the UIImagePickerController? Or would I need to make a new instance?

UserImage.jpg
Ricardo Silva

Nope, that view controller is Cordova related. It's the view controller into which all plugin's screens are added on top.

As you've seen, the Cordova plugin uses an xcframework for iOS. The code you're looking for belongs to that xcframework.

UserImage.jpg
Spencer Buhler

So any ideas of how I can accomplish what I'm trying to accomplish?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.