iOS Question IHttpUtils2

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel, All.
Are there issues with iHttpUtils2 Rel. 2.96 and B4I V7.50 ?

If i have this code:

B4X:
    Dim DONACASHBACK As HttpJob
            DONACASHBACK.Initialize("", Me)
            DONACASHBACK.Download2(Main.variabile, Array As String("Action","56","id", $"${id}"$))
            Wait For (DONACASHBACK) JobDone(DONACASHBACK As HttpJob)
            If DONACASHBACK.Success Then
                pnl_attendi.Visible = True
                btn_dona.Visible = False
                Sleep(200)
                Dim res As String
                res = DONACASHBACK.GetString
                ......


Crash ( debug and release ) on
B4X:
res = DONACASHBACK.GetString
and error is:
Error reading from stream: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}

if i comment 'Sleep(200) work.
Bug or another thing ?
Thank you
 

Star-Dust

Expert
Licensed User
Longtime User
The data it receives from the server is stored in a temporary file. when you call the getString (or other get) method this temporary file is read.

When you use sleep and exit of the SUB obviously this file is deleted and cannot be used again. At the getstring request it generates an error because it cannot find the file.

Suggest: Insert the sleep after saving the data received from the getstring in a string
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Good explanation. But I don't understand why the problem exists only for b4i. In B4A work.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
He also gave it to me on b4a on one occasion. I think a lot depends on the service that manages httpJob. I don't know the engine inside and can't answer
 
Upvote 0
Top