Hello,
there seems to be an problem with the iNetwork library at the UDPSocket object.
The iOS object seems not to be valid any longer after pressing the iPhone standy button
(maybe even after the app only gets to background).
The library or iOS seems to handle this fine not in any case.
There is no way to catch an exception inside the B4i code.
When starting to create a test app as short as possible first everything worked fine,
so maybe it is not directly reproducable.
But after the crash happened first it could simply be reproduced downto
only including/initializing the iReleaselogger object into an empty B4i project and doing the following steps:
-Compile app in release-mode
- Run App, press Home, press Standbybutton, press Home-button twice to reactive screen, press app-icon to bring app to foreground
-or Run App, press Standbybutton, press Home-button twice to reactivate screen
- the app appears and directly crashs/disappears; when pressing app-icon again it will be an new App-start instead of activating.
What I notized, maybe it is an hint:
case a) library changes UDP source port at every activate, even if only home button gets pressed
everything worked fine
case b) library does not change UDP source port after home button was pressed
I got above effect (silent crashing app)
Before this simple example was enough,
the larger test similar to my real, crashing app was:
After standby button and reactivating the app I sended an UDP packet to the app
(to the old UDP connection, so it doesnt reached the app)
and only after that I sended an UDP packet from the app by pressing an button.
There app crashed silent. (no crash info, no try/catch is working, app simply disappears)
there seems to be an problem with the iNetwork library at the UDPSocket object.
The iOS object seems not to be valid any longer after pressing the iPhone standy button
(maybe even after the app only gets to background).
The library or iOS seems to handle this fine not in any case.
There is no way to catch an exception inside the B4i code.
When starting to create a test app as short as possible first everything worked fine,
so maybe it is not directly reproducable.
But after the crash happened first it could simply be reproduced downto
only including/initializing the iReleaselogger object into an empty B4i project and doing the following steps:
-Compile app in release-mode
- Run App, press Home, press Standbybutton, press Home-button twice to reactive screen, press app-icon to bring app to foreground
-or Run App, press Standbybutton, press Home-button twice to reactivate screen
- the app appears and directly crashs/disappears; when pressing app-icon again it will be an new App-start instead of activating.
What I notized, maybe it is an hint:
case a) library changes UDP source port at every activate, even if only home button gets pressed
everything worked fine
case b) library does not change UDP source port after home button was pressed
I got above effect (silent crashing app)
B4X:
'Test only using Releaselogger
'Compile app in release-mode
' Run App, press Home, press Standbybutton, press Home-button twice to reactive screen, press app-icon to bring app to foreground
'or Run App, press Standbybutton, press Home-button twice to reactivate screen
' the app appears and directly crashs/disappears; when pressing app-icon again it will be an new App-start instead of activating
'Code module
#Region Project Attributes
#ApplicationLabel: B4i UDP Test
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait
#iPadOrientations: Portrait
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 7
#End Region
Sub Process_Globals
Dim Const cHOST ="192.168.0.5" As String 'IP of UDP-Server
Dim Const cPORT =1111 As Int
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Dim oReleaseLogger As ReleaseLogger
Dim Timer1 As Timer
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
NavControl.ShowPage(Page1)
oReleaseLogger.Initialize(cHOST, cPORT)
Log("App-Start")
Timer1.Initialize("Timer", 2000)
End Sub
Private Sub Application_Active
Timer1.Enabled=True
End Sub
Sub Timer_Tick
'will only be reached if app doesnt crash at App-Active ReleaseLogger action
Timer1.Enabled=False
Log("App-Activate delayed")
End Sub
Before this simple example was enough,
the larger test similar to my real, crashing app was:
After standby button and reactivating the app I sended an UDP packet to the app
(to the old UDP connection, so it doesnt reached the app)
and only after that I sended an UDP packet from the app by pressing an button.
There app crashed silent. (no crash info, no try/catch is working, app simply disappears)