iOS Question App Works with release, crash with debug

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
Hi all,
I have a strange problem.
My app works with release app and crash with debug app without any error message.
App simply is closed.



I put log alerts to see where it appens.



This is the log....
I have no mistake, but seems the instruction that crash is LoadLayout.
But all works with release app...
Someone can help me to solve it?
Thanks inadvance
Marcom
 

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
I found out that any function started from menu crashes in the same way.
Then the problem isn't in the layout, but perhaps in the menu.
But why it works with release app?

I don't know how create a small project woth same problem. Ican send the whole project, but here or by email?
I think a .zip by email is better. Whitch email?
 
Upvote 0

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
"menu" is the module that calls other modules.
When I use debug versione some module works, some others crash without messages or logs.
After a crash I need to uninstall app.
I don't understand if it appens cause "menu" module o cause called modules.
But in release module it works.....
I post "menu" code.

B4X:
'Class module
Sub Class_Globals
    Private Messaggio As String
    Private PageX As Page
    
    Public menuTFutente As TextField
    Public menuTFpassword As TextField
    
    Public menuLButente As Label
    Public menuLBpassword As Label
    
    Public menuIVlogo As ImageView
    Private menuIVfoto As ImageView
    
    Private menuLBannomese As Label
    
    Private menuBTcambiadata As Button
    Private menuBTavanti As Button
    Private menuBTlista As Button
    Private menuBTsitmese As Button
    Private menuBTfotoposto As Button
    Private menuBTarrow As Button
    Private menuIVeye As ImageView
    Private Funzione As Int
    Private unus As String

    Dim flippassw As Boolean
    
    Dim BBDataURL As String
    Dim logo As String

    Dim FTP As FTP
    Private appIVlogo As Bitmap
    Private applogo As String

End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
    Messaggio="Dentro Menu"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
    Log(Messaggio)

    PageX.Initialize("Pagex")
    PageX.RootPanel.LoadLayout("menu")
    PageX.Title=Main.myappname & " " & Main.myappvers

'    Dim BG As Bitmap = LoadBitmapSample(File.DirAssets, "1619731.jpg", Activity.Width, Activity.Height)
'    PageX.SetBackgroundImage(BG)
    
    menuTFutente.Text=Main.manutente
    menuTFpassword.Text=Main.manpassword

    Main.IVdipe.Initialize(File.DirAssets,"man.png")
    
    menuLButente.Text=ML.menu_lb_utente
    menuLBpassword.Text=ML.menu_lb_password

    menuIVfoto.Bitmap=Main.IVdipe
    
    If Main.mananno="" Then
        Main.mananno=Main.MyYear
        Main.manmese=Main.Mymonth
    End If
    menuLBannomese.Text=Main.MyMeseDesc(Main.manmese-1) & " " & Main.mananno
        
    PrimoPasso
'    Log("ServerFTP: " & Main.ServerFTP)
'    Log("CartellaFTP: " & Main.CartellaFTP)
'    Log("PortaFTP: " & Main.PortaFTP)
'    Log("UtenteFTP: " & Main.UtenteFTP)
'    Log("PasswordFTP: " & Main.PasswordFTP)


    Dim ftp_dest As String
    ftp_dest = Main.CartellaFTP & Main.manutente & ".jpg"
    FTP.Initialize("FTP", Main.ServerFTP, Main.PortaFTP, Main.UtenteFTP, Main.PasswordFTP)
    FTP.PassiveMode=True
    FTP.DownloadFile(ftp_dest,False,File.DirDocuments, "dipe.jpg")

    Log("dipe.jpg exist "&File.Exists(File.DirDocuments, "dipe.jpg"))
    If File.Exists(File.DirDocuments, "dipe.jpg")=True Then
        Main.IVdipe.Initialize(File.DirDocuments,"dipe.jpg")
    Else
        Main.IVdipe.Initialize(File.DirAssets,"man.png")
    End If
    menuIVfoto.Bitmap=Main.IVdipe
    
    Funzione=0
    Main.NavControl.ShowPage(PageX)
    Messaggio="Menu OK"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))

End Sub

Sub PageX_Resize (Width As Int,Height As Int)
    Messaggio="menu Cliente="&Main.manager.GetString("cliente")&" societa "&Main.manager.GetString("societa")
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
    Log(Messaggio)
    If Main.manager.GetString("cliente")="0" Then        '    ServiceH24
        menuIVlogo.Width=94%x
        menuIVlogo.Height=15%y
    End If
    If Main.manager.GetString("cliente")="1" Then        '    Sirio
        If Main.manager.GetString("societa")="1" Then
            menuIVlogo.Width=94%x
            menuIVlogo.Height=15%y
            menuIVlogo.left=(100%x-menuIVlogo.Width)/2
        End If
        If Main.manager.GetString("societa")="2" Then
            menuIVlogo.Width=28%x
            menuIVlogo.Height=15%y
            menuIVlogo.left=(100%x-menuIVlogo.Width)/2
        End If
        If Main.manager.GetString("societa")="3" Then
            menuIVlogo.Width=38%x
            menuIVlogo.Height=15%y
            menuIVlogo.left=(100%x-menuIVlogo.Width)/2
        End If
    End If
    If Main.manager.GetString("cliente")="2" Then        '    GSA
        menuIVlogo.Width=38%x
        menuIVlogo.Height=20%y
    End If
    Log ("menuIVlogo.Width "&menuIVlogo.Width&" menuIVlogo.height "&menuIVlogo.height)
    
End Sub

Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
    Log(ServerPath & ", Success=" & Success)
    If Success = True Then
        Main.IVdipe.Initialize(File.DirDocuments,"dipe.jpg")
        menuIVfoto.Bitmap=Main.IVdipe
    End If
End Sub

' Bottone vedi password
Sub menuIVeye_Click
    Messaggio="menuIVeye_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
    If flippassw=False Then
        menuTFpassword.PasswordMode=False
        flippassw=True
    Else   
        menuTFpassword.PasswordMode=True
        flippassw=False
    End If   
        
End Sub

' Bottone di cambio data
Sub menuBTcambiadata_Click
    Messaggio="menuBTcambiadata_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
    Funzione=1
    Main.PGMcambiadata.Initialize
    
    Messaggio="dopo primopasso"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
End Sub

' Bottone di timbrature
Sub menuBTavanti_Click
    Funzione=2
    Main.PGMtimbra.Initialize
    
    Messaggio="menuBTavanti_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
End Sub

' Bottone di turni
Sub menuBTlista_Click
    Funzione=3
    Main.PGMage.Initialize
    
    Messaggio="menuBTlista_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
End Sub

' Bottone di riepiloghi
Sub menuBTsitmese_Click
    Funzione=4
    Main.PGMdipe.Initialize
    
    Messaggio="menuBTsitmese_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
End Sub

' Bottone di foto evento
Sub menuBTfotoposto_Click
    Funzione=5
    Main.PGMfotoeventi.Initialize
    
    Messaggio="menuBTfotoposto_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
        
End Sub

' Bottone di altro menu
Sub menuBTarrow_Click
    Funzione=6
    Messaggio="menuBTaltro_Click"
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
    Main.PGMmenu2.Initialize
        
End Sub

Sub menuTFutente_EndEdit
    Main.manutente=menuTFutente.Text
'    Log("getute: " & manager.getString("manutente"))
End Sub

Sub menuTFpassword_EndEdit
    Main.manpassword=menuTFpassword.Text
    LeggiUser
End Sub

Sub PrimoPasso
    Messaggio="primopasso Cliente="&Main.manager.GetString("cliente")&" societa "&Main.manager.GetString("societa")& " funzione "&Funzione
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
    Log(Messaggio)

'    ServiceH24
    If Main.manager.GetString("cliente")="0" Then
        If Main.manager.GetString("societa")="1" Then
            Main.TitoloMsg="ServiceH24"
            Main.ServerUrl = "http://www.mamavisoftware.it/serviceh24/ssconnectdbxandroid.php"
            Main.ServerFTP = "ftp.mamavisoftware.it"
            Main.CartellaFTP = "/www.mamavisoftware.it/buca/fotobuca/"
            Main.CartellaEventi = "/www.mamavisoftware.it/buca/fotobuca/"
            Main.PortaFTP = "21"
            Main.UtenteFTP = "xxxxxxxx@aruba.it"
            Main.PasswordFTP = "xxxxxxxxx"
            Main.Emailsocieta = "info@xxxxxxxxx.it"
            menuIVlogo.Bitmap=Main.IVsoc0
            Main.LogoLogo=Main.logsoc0
        End If
    End If

'    Sirio       
    If Main.manager.GetString("cliente")="1" Then
        If Main.manager.GetString("societa")="1" Then        '    Sirio
            Main.TitoloMsg="Sirio"
            Main.ServerUrl = "http://www.cooperativa-servizi.it/sirio/ssconnectdbxandroid.php"
            Main.ServerFTP = "ftp.cooperativa-servizi.it"
            Main.CartellaFTP = "/www.cooperativa-servizi.it/sirio/fotodipendenti1/"
            Main.CartellaEventi = "/www.cooperativa-servizi.it/sirio/fotoeventi1/"
            Main.PortaFTP = "21"
            Main.UtenteFTP = "xxxxxxxx@aruba.it"
            Main.PasswordFTP = "xxxxxxxxx"
            Main.Emailsocieta = "info@xxxxxxxxx.it"
            menuIVlogo.Bitmap=Main.IVsoc11
            Main.LogoLogo=Main.logsoc11
        End If
        If Main.manager.GetString("societa")="2" Then        '    Daga
            Main.TitoloMsg="Daga"
            Main.ServerUrl = "http://www.cooperativa-servizi.it/sirio/ssconnectdbxandroid.php"
            Main.ServerFTP = "ftp.cooperativa-servizi.it"
            Main.CartellaFTP = "/www.cooperativa-servizi.it/sirio/fotodipendenti2/"
            Main.CartellaEventi = "/www.cooperativa-servizi.it/sirio/fotoeventi2/"
            Main.PortaFTP = "21"
            Main.UtenteFTP = "xxxxxxxx@aruba.it"
            Main.PasswordFTP = "xxxxxxxxx"
            Main.Emailsocieta = "info@xxxxxxxxx.it"
            menuIVlogo.Bitmap=Main.IVsoc12
            Main.LogoLogo=Main.logsoc12
        End If
        If Main.manager.GetString("societa")="3" Then        '    Security Service
            Main.TitoloMsg="SecurityService"
            Main.ServerUrl = "http://www.cooperativa-servizi.it/sirio/ssconnectdbxandroid.php"
            Main.ServerFTP = "ftp.cooperativa-servizi.it"
            Main.CartellaFTP = "/www.cooperativa-servizi.it/sirio/fotodipendenti3/"
            Main.CartellaEventi = "/www.cooperativa-servizi.it/sirio/fotoeventi3/"
            Main.PortaFTP = "21"
            Main.UtenteFTP = "xxxxxxxx@aruba.it"
            Main.PasswordFTP = "xxxxxxxxx"
            Main.Emailsocieta = "info@xxxxxxxxx.it"
            menuIVlogo.Bitmap=Main.IVsoc13
            Main.LogoLogo=Main.logsoc13
        End If
    End If
    
'    GSA
    If Main.manager.GetString("cliente")="2" Then
        If Main.manager.GetString("societa")="1" Then
            Main.TitoloMsg="GSA"
            Main.ServerUrl = "http://www.mamavisoftware.it/serviceh24/ssconnectdbxandroid.php"
            Main.ServerFTP = "ftp.mamavisoftware.it"
            Main.CartellaFTP = "/www.mamavisoftware.it/buca/fotobuca/"
            Main.CartellaEventi = "/www.mamavisoftware.it/buca/fotobuca/"
            Main.PortaFTP = "21"
            Main.UtenteFTP = "xxxxxxxx@aruba.it"
            Main.PasswordFTP = "xxxxxxxxx"
            Main.Emailsocieta = "info@xxxxxxxxx.it"
            menuIVlogo.Bitmap=Main.IVsoc2
            Main.LogoLogo=Main.logsoc2
        End If
    End If

    Main.manager.SetString("FTP_server", Main.manFTP_server)
    Main.manager.SetString("FTP_cartella", Main.manFTP_cartella)
    Main.manager.SetString("FTP_porta", Main.manFTP_porta)
    Main.manager.SetString("FTP_user", Main.manFTP_user)
    Main.manager.SetString("FTP_password", Main.manFTP_password)

    If Main.manutente<>"" Then LeggiUser
End Sub

Sub LeggiUser
    Log("Main.ServerUrl "&Main.ServerUrl)
    Main.Qry="Select t02dipendentipassword,t02dipendentinome,t02dipendenticognome,t02dipendentitimbraturamanuale FROM t02dipendenti where t02dipendentimatricola=" & Main.manutente
    Main.jobx.Initialize("Job0", Me)
    Main.jobx.PostString(Main.ServerUrl, Main.Qry)
End Sub

Sub JobDone (Job As HttpJob)
    Messaggio="JobName = " & Job.JobName & ", Success = " & Job.Success
'    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        Select Job.JobName

            Case "Job0"

                Dim parser As JSONParser
                Dim response As String
                response = Job.GetString
                parser.Initialize(response)
                Main.rows = parser.NextArray
                
                If Main.rows.size > 0 Then
                    Dim m As Map
                    m = Main.rows.Get(0)
                    Main.t02password = m.Get("t02dipendentipassword")
                    Main.t02nome=m.Get("t02dipendentinome")
                    Main.t02cognome=m.Get("t02dipendenticognome")
                    Main.t02timbraturamanuale=m.Get("t02dipendentitimbraturamanuale")
                    Log("Cognome: " & Main.t02cognome & " Nome: " & Main.t02nome)
                    If Main.t02password <> Main.manpassword Then
                        Messaggio=ML.menu_msg_passworderrata
                        Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
                    Else

                        Dim ftp_dest As String
                        ftp_dest = Main.CartellaFTP & Main.manutente & ".jpg"
                        FTP.Initialize("FTP", Main.ServerFTP, Main.PortaFTP, Main.UtenteFTP, Main.PasswordFTP)
                        FTP.PassiveMode=True
                        Dim sf As Object = FTP.DownloadFile(ftp_dest,False,File.DirDocuments, "dipe.jpg")
                        
                        Wait For (sf) FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
                        If Success Then
                            Log("file was downloaded successfully")
                        Else
                            Log("Error downloading file")
                        End If
                        
                        
'                        Log("ServerFTP: " & Main.ServerFTP)
'                        Log("CartellaFTP: " & Main.CartellaFTP)
'                        Log("PortaFTP: " & Main.PortaFTP)
'                        Log("UtenteFTP: " & Main.UtenteFTP)
'                        Log("PasswordFTP: " & Main.PasswordFTP)
'                        Log("ftp_dest: " & ftp_dest)

                        Log("dipe.jpg exists "&File.Exists(File.DirDocuments, "dipe.jpg"))
                        If File.Exists(File.DirDocuments, "dipe.jpg")=True Then
                            Main.IVdipe.Initialize(File.DirDocuments,"dipe.jpg")
                        Else
                            Main.IVdipe.Initialize(File.DirAssets,"man.png")
                        End If


                        menuIVfoto.Bitmap=Main.IVdipe

                        Main.Qry="Select * FROM t99parametri"
                        Main.jobx.Initialize("Job1", Me)
                        Main.jobx.PostString(Main.ServerUrl, Main.Qry)
                    End If
                Else
                    Messaggio="Utente errato: Accesso non autorizzato"
                    Msgbox2("Msg",Messaggio,Main.TitoloMsg,Array("OK"))
                End If

            Case "Job1"

                Dim parser As JSONParser
                Dim response As String
                response = Job.GetString
                parser.Initialize(response)
                Main.rows = parser.NextArray
                If Main.rows.size > 0 Then
                    Dim m As Map
                    m = Main.rows.Get(0)
                    Main.t99distanza=m.Get("t99parametritolleranzadistanza")
                    Log ("Funzione " & Funzione)
'                    If Funzione=1 Then Main.PGMcambiadata.Initialize
'                    If Funzione=2 Then Main.PGMtimbra.Initialize
'                    If Funzione=3 Then Main.PGMage.Initialize
'                    If Funzione=4 Then Main.PGMdipe.Initialize
'                    If Funzione=5 Then Main.PGMfotoeventi.Initialize
'                    If Funzione=6 Then Main.PGMmenu2.Initialize
                End If
    
        End Select
        
    Else
        Log("Error: " & Job.ErrorMessage)
        Main.hd.ToastMessageShow("Errore: " & Job.ErrorMessage, True)
    End If
    Job.Release
    Main.hd.ProgressDialogHide
End Sub
 
Upvote 0

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
I put a video.
When I click a specific function of my app Debug closes.
The function works correctly, show new page for 2 seconds, but, when debug closes, my app is closed too.
In rlease mode it works perfectly.
It's possible it is a b4i bug?
Thanks
Marcom
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…