Hi all,
within a B4XPages project I started to develop the app in the B4A (Android) version and now I'm checking the operation of the respective B4i (iOS) version.
Debugging the B4ì version I encountered a problem in the management of Boolean types.
Doing a search in the forum I realized that in iOS there is no real boolean type, so the following line of code worked correctly on the Android version (B4A) but not on the iOS version (B4i):
So to get the check to work correctly i solved it like this:
In your opinion is it a good solution to be adopted within all the modules of the B4XPages App or is it better to use another approach?
Thanks in advance for your suggestions
Luca.
within a B4XPages project I started to develop the app in the B4A (Android) version and now I'm checking the operation of the respective B4i (iOS) version.
Debugging the B4ì version I encountered a problem in the management of Boolean types.
Doing a search in the forum I realized that in iOS there is no real boolean type, so the following line of code worked correctly on the Android version (B4A) but not on the iOS version (B4i):
B4X:
dim published as string = "true" '--> I got this value from a JSON string field
dim IsPublished as boolean = published
if IsPublished then
'Do something...
end if
So to get the check to work correctly i solved it like this:
B4X:
dim IsPublished as Boolean
#if B4A
If published = "true" Then
IsPublished = True
Else
IsPublished = False
End If
#End If
#if B4i
If published = "1" Then
IsPublished = True
Else
IsPublished = False
End If
#End If
If IsPublished = True Then
'Do something...
end if
In your opinion is it a good solution to be adopted within all the modules of the B4XPages App or is it better to use another approach?
Thanks in advance for your suggestions
Luca.