iOS Question HTTPJob GetString2 Error

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I am facing an error when calling GetString2 after a job is completed successfully

B4X:
Public Sub GetString2(Encoding As String) As String
    Return res.GetString2(Encoding)
End Sub

I get the following error
B4X:
Error reading from stream: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"

The debug code below

B4X:
    Log(res.ContentEncoding)
    Log(res.ContentLength)
    Log(res.ContentType)
    Log(res.GetHeaders)
    Log(res.StatusCode)

produced the following results

B4X:
gzip
255
text/html; charset=utf-8
(read only map) {
    "Cache-Control" = private;
    "Content-Encoding" = gzip;
    "Content-Length" = 255;
    "Content-Type" = "text/html; charset=utf-8";
    Date = "Wed, 24 Aug 2016 21:54:49 GMT";
    Server = "Microsoft-IIS/7.0";
    "Set-Cookie" = "ASP.NET_SessionId=01g2dd2cwpbpo5av3mxftikk; path=/; HttpOnly";
    Vary = "Accept-Encoding";
    "X-AspNet-Version" = "4.0.30319";
    "X-Powered-By" = "ASP.NET";
}
200

Thanks in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
Actually I just found the error, but I am going to leave it in here in case someone runs into the same issue.

Here is what I found,

The code I used for Job Complete looked like this. The corresponding DoneEvent called GetString2

B4X:
Public Sub Complete (res1 As HttpResponse)
    res = res1
    CallSubDelayed2(target, DoneEvent, Me)

End Sub

once I changed the code to

B4X:
Public Sub Complete (res1 As HttpResponse)
    res = res1
    CallSub2(target, DoneEvent, Me)

End Sub

the error disappeared.
 
Upvote 0
Top