Hello, 

I'm currently working on a time registration application where the user doesn't have to fill in the hours he worked because the application fetches every 15 minutes the location to see if the user is stil on location. When the timer is executed and the user is outside the radius the stoptime needs to be registered and the other way around with the start time. (This is all a client action)

The calculations of radius, set starttime and stoptime are all completed and I can't get the application to work on the background of the phone to fetch and execute the action. (So when the application is on the foreground it all works but when the application is on the background not.)

I tried the background location plugin but this doesn't execute the client action wat the most implortant part of the action is. 

Does anybody know if it is possible to call a action in the background what can support this?


Hi Ben,

Are you using the GeoFence plugin? We have used the GeoFence succesfully to send notifications when we are outside a certain perimeter, even if the app is not currently active.

Hi Kilian, 

Thanks for your response. 

Unfortunately the Geofence plugin doesn't support Swift 3 witch causes the application not to load the plugin because it is in swift 2,3. I keep getting the error message "Error generating application. At least one Cordova plugin used in the build requires Swift but no "Swift language version" build setting was defined"

Hi Ben,

I don't understand. How can you use Swift when you are creating an OutSystems app?

Hi Kilian, 

When I try to publish the application and generate a native app to download on my phone I get the error message "Error generating application. At least one Cordova plugin used in the build requires Swift but no "Swift language version" build setting was defined". I Tried to look in the settings of the app where to define the language but I couldn't find it. 


Hi Ben,

Is it an iPhone you are installing it to?

Hi Kilian, 

I would like to install It to a iPhone. 

but when I try to generate the app in outsystems service studio (select module-> generate mobile app) it gives the error message in the service studio itself at the apple app generator. (so it won't even generate a app for IOS that I can download because of the error). 

Hi Ben,

I see, sorry, read too quickly. I'm not sure what goes wrong here, I'll ask around.

Hi Kilian, 

No problem, it's nice of you to help me with this problem. Thanks for asking around

Hi,

I am also getting same error 

Error generating application. At least one Cordova plugin used in the build requires Swift but no "Swift Language Version" build setting was defined. Check your plugins configuration.


Any solutions ?

is it possible specify swift Language version in "Extensiblity Configuration"


Thank you,

Mani

Hi Mani

Unfortunately I wasn’t able to fix this plugin. I fixed my own problem by building my own geofence actions using the havershine method and the on resume action with JavaScript timeout function and asynchronous actions. It’s a lot of hassle and work to get it working and only then it fetches it every x amount of minutes. 


Unfortunate I can’t share my project because it is build in in the entire application. 

Hope this helped you a little bit. 


Solution

Hello, everyone,


It's not crystal clear, but MABS does support plugins with Swift code, with some adjustments:

  1. You have to add Swift support to your app via a plugin that requires it, using a dependency entry, or a new plugin altogether; 
    1. You can and should use this Add Swift Support plugin to do it, paying attention to the required Cordova CLI/iOS versions;
    2. Bear in mind that MABS may be upgraded to a new stack, which may include a newer Xcode version; the latest announcement in this regard was this August, albeit no update was done to Xcode.
  2. You need to write your Swift plugin code on language versions 3 or 4 (or convert it), which are the ones MABS currently supports
    1. Xcode 8.3 offers a migration tool that helps you convert it from version 2.3 to 3 (documentation);
    2. If you want to take it a step further and migrate from Swift 3 to 4, you can use a similar tool available on Xcode 9 (documentation);
    3. Whichever of these two versions you pick, make sure you use the corresponding "UseSwiftLanguageVersion" preference value on the the home module of your mobile app, as documented on the plugin's page.

After ensuring these two details are fulfilled, you should be able to generate your mobile app.

Be sure to let me know if you need further assistance getting things to work.


Best regards,

Carlos Simões

Solution