iOS Question [solved] Object was not initialized (NSMutableURLRequest)

udg

Expert
Licensed User
Longtime User
Hi all,
a very common sub that I use to check whether there's Internet access (and specifically whether my server is reachable).
Works in Android. Fails in iOS
B4X:
'Check connection to DGC server. Timeout in 5 seconds
Public Sub CheckInternet As ResumableSub
    LogColor("check Internet start", 0xFFFFFF00)
    Dim j As HttpJob
    j.Initialize("", Me)
    j.GetRequest.Timeout = 5000
    j.Download(wscdisp)                                'Hello service
    Wait For (j) JobDone(j As HttpJob)
    Dim res As Boolean = j.Success
    If j.Success Then
        Log(j.GetString)
    Else
        Log("No connection to server")
    End If
    j.Release
    LogColor("check Internet finish", 0xFFFFFF00)
    Return res
End Sub

wscdisp is working if tested by browser and any Android-based app. It's an HTTPS URL if it can matters.
 

udg

Expert
Licensed User
Longtime User
Solved. I moved the GetRequest after Download and it's working.
 
Upvote 0
Top