iOS Question [Solved] (My stupid mistake)Need help with jRDC2 and ATS on local networks

MrKim

Well-Known Member
Licensed User
Longtime User
Edit: This is the sort of thing that can drive a man crazy!
The upshot is I had modified my code and the result was that in some places the address had http://// NOT http://.
Android AND Java were perfectly happy with this.
iOS didn't like it and responded with:
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
Once again Erel I apologize for wasting your time.
I'm going to bed.

My app is working fine in B4J And B4A, then I tried to get it running on B4i and ran into ATS.

I messed around with #ATSEnabled: True/False with various combinations of
B4X:
'    #PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
'    #PlistExtra: </dict>
 
'#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
'#PlistExtra: <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
'#PlistExtra: </dict>
'
'#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
'#PlistExtra: <key>NSAllowsArbitraryLoads</key><true/>
'#PlistExtra: </dict>
'
'#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
'#PlistExtra: <key>NSExceptionAllowsInsecureHTTPLoads</key><true/>
'#PlistExtra: </dict>
'
'#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
'#PlistExtra: <key>NSAllowsLocalNetworking</key><true/>
'#PlistExtra: </dict>
And I either get Could not connect to the server. or The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
I am using an iPhone 6 running 12.5.4. I am on a local private network and connecting to jRDC2 using an ip address.
Here is the thing. The jRDC2 server will be going on 50 to 100 customer networks over which we have very little control. The will be connecting only to their local network using an IP:port, not a UNC.
I am using DBRequestmanager. Interestingly, some things seem to work, some don't.
These work:
B4X:
    Dim Ver As HttpJob, RetVal As String
    Try
        Ver.Initialize("Ver", Me)
        Ver.Download2($"${HTTPType}${MP.IPAddre}:${MP.PortNum}/checkversion"$, Array As String("Version", MP.DBVersion))
        Ver.GetRequest.Timeout = 5000
        Wait For (Ver) JobDone(j As HttpJob)
        If j.Success Then
.
.
.
    Dim req As DBRequestManager = CreateRequest
    Dim cmd1 As DBCommand = CreateCommand("DB_NAME", Null)
    Wait For (req.ExecuteQuery(cmd1, 0, "DB_NAME")) JobDone(j As HttpJob)
    If j.Success Then
This Does not:
B4X:
    Dim req As DBRequestManager = CreateRequest
    Dim cmd1 As DBCommand = CreateCommand("GetEmployees", Null)
    Wait For (req.ExecuteQuery(cmd1, 0, "GetEmployees")) JobDone(j As HttpJob)
    If j.Success Then
The ones that don't work never make it to the server.
Any help appreciated.
 
Last edited:

MrKim

Well-Known Member
Licensed User
Longtime User
Why not disable ATS completely? As far as I know, it will not cause your app to be rejected.
I tried setting #ATSEnabled: False With NO #PlistExtra:s But I still get "Could not connect to the server."
I run the exact same code on an android and it works fine.
 
Upvote 0
Top