iOS Question [Solved] HttpJob error to avoid - Never fires job response

hatzisn

Expert
Licensed User
Longtime User
Hi everyone,

I am almost sure this is not the correct forum to post this, but I am going to do it here anyway since it is not a tutorial of something and it is not a code snippet.

Take a look at this code:
B4X:
Dim hj as HttpJob
hj.Download("https://www.serversomething.com")
Wait For (hj) JobDone(job as HttpJob)
If job.Success Then
   ' Do something
Else
   ' Do not do something
End If

If it is compiled the code does not produce any errors, but it never fires the job response part.
Did you notice what is wrong?

I missed the part of :
B4X:
hj.Initialize("", Me)

If I add this line to the code and turn the code into this:
B4X:
Dim hj as HttpJob
hj.Initialize("", Me)
hj.Download("https://www.serversomething.com")
Wait For (hj) JobDone(job as HttpJob)
If job.Success Then
   ' Do something
Else
   ' Do not do something
End If

The job response fires and everything works ok. It bugged me very long time but finally I got that.

I hope that someone will benefit from this,
Cheers
 
Top