iOS Question [INSOLVED] AsyncStreams error

Star-Dust

Expert
Licensed User
Longtime User
My SERVER app working fine in debug mode crashes when in release mode.
The moment that crashes is when the client is shut down abruptly or sometimes just at startup.

I have two Crash-Reports but I can't figure out what the error is. Anyone know how to translate what is written?

 

Star-Dust

Expert
Licensed User
Longtime User
I managed everything with ServerSocket and Astream
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The error happens in a module named servletrequest in a sub named CompleteDate.
Thanks, check it out now. Maybe it seems like a trivial question, but not knowing iOS well, sometimes minimal problems for me become huge.

Thanks again.

B4X:
Private Sub CompleteDate(DT As Long) As String
    Return $"${DDay(DateTime.GetDayOfWeek(DT))}, ${DateTime.GetDayOfMonth(DT)} ${MMmonth(DateTime.GetMonth(DT))} ${DateTime.GetYear(DT)} ${DateTime.Time(DT)} GMT"$
End Sub
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Fixed one created another. ?

 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
IReleaseLogger did not report an error to me, I changed the CharacterEncoding to UTF-8 and it does not generate errors. Maybe it was that but I'm not sure because I changed a lot of things.

Maybe it can be useful to someone in the future.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I will add another guess: make sure not to treat raw bytes as string. If you need to "collect" bytes then use B4XBytesBuilder.
I understood that the hard way this morning, and I used B4XBytesBuilder which solved many problems for me.

Now there are other strange problems, but maybe in another post I will address them.
But I think I'll have to start from scratch and rewrite it
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Update: Summarizing, the problems that generated the error on AsyncStreams were three. None of these three errors were detected by the ReleaseLogger, so I struggled to find them.

(1) The encoding of the text that I send with AsyncStreams must be UTF8, (2) there was an error in the formula to transform the date into a string (my wrong)

(3) Lastly, many 'weird' issues have been fixed by acknowledging that the iPhone device I use for testing is slow, especially heavier uploads take a long time. Therefore, the requests must be kept on hold until the execution of the previous ones is completed in order not to compromise the transmission.
Using an UpLoad progression index I discovered and solved the strange problems that occurred.

I have to get a new iPhone, I know! But I am sorry to have to give Steve Jobs hundreds of dollars, especially knowing that he is also dead and he won't need it.
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
AsyncStreams has nothing to do with encoding. AsyncStreams sends and receives bytes.
Yes that's right, I expressed myself badly. I meant that when I send ( with AsyncStreams) the HandShake string turning it into Byte, I had to use UTF8 encoding otherwise it would fail.

The same when I received the Bytes from AsyncStreams and extracted the HandShake string I had to use UTF8 encoding.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
There is no valuable information in this report.
I finally got an error log with iReleaseLogger. There is an error actually on aSyncSteams.
B4X:
Target is null. Method called: _astream_newdata:
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  HttpServer           +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 172
  HttpServer           -[B4I raiseEvent:event:params:] + 548
  HttpServer           __50-[B4I raiseEventFromDifferentThread:event:params:]_block_invoke + 60
  libdispatch.dylib    <redacted> + 24
  libdispatch.dylib    <redacted> + 16
  libdispatch.dylib    <redacted> + 1068
  CoreFoundation       <redacted> + 12
CoreFoundation       <redacted> + 1924
CoreFoundation       CFRunLoopRunSpecific + 436
GraphicsServices     GSEventRunModal + 104
UIKitCore            UIApplicationMain + 212
HttpServer           main + 128
libdyld.dylib        <redacted> + 4

The offending event is this:
B4X:
private Sub astream_NewData (Buffer() As Byte)
    Cache.Append(Buffer)
    InTimeBrowserResponse=True
    ExtractHandShake
End Sub
I still don't understand what the problem is that only comes up in the release version
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
This observation was very helpful to me. The aSyncStream instance was released due to premature closure of the stream
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…