iOS Question Error: Error Domain=kCLErrorDomain Code=4 "(null)"

Christian García S.

Active Member
Licensed User
Hello,

When I try to run a app in debug mode, I get this error in log console:

B4X:
Error: Error Domain=kCLErrorDomain Code=4 "(null)"

The issue is beacuse sometimes a lateral menu is loaded and other times the menu is s empty and I can't continue development, I tested with debug and always run the the same code with the difference the menu is empty.

The menu I use is iSideMenu, I have B4i 4.40.

Few weeks ago I was without issues.

Thanks in advance.

Christian
 

Christian García S.

Active Member
Licensed User
Hello, this is the real issue in logs I can't see abnormal thing, how I said before, one times works other times doesn't work.

upload_2018-1-4_10-4-36.png


iSideMenu sometimes load the content, other times doesn't load the content, there are not a reason for that.

These are images with menu loaded and without menu.

upload_2018-1-4_10-22-45.png


upload_2018-1-4_10-22-58.png


Thanks in advance
 
Upvote 0

Christian García S.

Active Member
Licensed User
Thanks Erel, I removed ImageDownloader.

I implemented a function:

B4X:
Sub DownloadImage(image As String, ImgView As ImageView)   
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(image)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim bmp As Bitmap = J.GetBitmap
        ImgView.Bitmap = bmp
    End If
    j.Release
End Sub

and I call from CreateListItem:

B4X:
Sub CreateListItem(Nombre As String, Image As String, Details As String) As Panel
    Dim p As Panel
            
    p.Initialize("")
'    p.Width = 100%x
'    p.Height = 220dip
    
    p.SetLayoutAnimated(0, 1, 0, 0, clvcards.GetBase.Width, 250dip) 'set the size before the layout is loaded
    p.LoadLayout("lstcards")
    
'    imgCard.Width = 100%x
'    lblDetails.Width = 100%x
'    lblMore.Width = 90%x
    
    lblDetails.Text = "  " & Details
    lblMore.Text = "   " & lblMore.Text

    DownloadImage(Image, imgCard)
    
    Return p
End Sub

But the results are the same, sometimes load the menu sometimes not, I think 90% times menu is not loaded. Customlistview in above code is for a list of cards in main screen.

The app menu is load with http job too.

Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why are you only filling the side menu after the http requests?

It timeouts here and the list remains empty.

Note that this line is wrong:
B4X:
lp.RootPanel.AddView(tv, 0, imgFondo.Height, 100%x, 100%y)
You should only use %x / %y in Page_Resize event.
You should instead add the TableView with the designer as a custom view and make sure that it is anchored to both sides.
 
Upvote 0

Christian García S.

Active Member
Licensed User
Thanks Erel,

It timeouts here and the list remains empty.

Always Sub FillDrawer is called after the http request is done

You can check in this sub

B4X:
Sub GetAppMenu
    Dim j As HttpJob
    Dim Resultado As List
    
    j.Initialize("appmenu", Me)
    j.download2("http://" & Globals.ServerIP & "/app/test.php", _
    Array As String ("username", Globals.usuarioapp,"action", "appmenu"))
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim res As String
        res = J.GetString
        
        Dim JParser As JSONParser
        Dim resMap As Map
        JParser.Initialize(res)
                
        Globals.SQL1.ExecNonQuery("DELETE FROM menu")
        Resultado = JParser.NextArray 'returns a list with maps
        For i = 0 To Resultado.Size - 1
            resMap= Resultado.Get(i)
            Log(resMap.Get("title"))
            Log(resMap.Get("ordering"))
            Globals.FillMenu(resMap.Get("id"), resMap.Get("title"), resMap.Get("ordering"), resMap.Get("tipo"), resMap.Get("icon"), resMap.Get("con_html"), _
                        resMap.Get("fac_url"), resMap.Get("twi_url"), resMap.Get("lin_url"), resMap.Get("web_url"), _
                        resMap.Get("web_emb"), resMap.Get("ema_address"), resMap.Get("ema_subject"), resMap.Get("ema_template"), _
                        resMap.Get("for_name"),resMap.Get("num_phone"))                   
        Next
        FillDrawer
    End If       
End Sub

Http request and insert into database, here logs:

upload_2018-1-10_12-31-7.png


Once the table is filled, the FillDrawer function is called to fill the menu, here logs.

upload_2018-1-10_12-39-26.png


Why are you only filling the side menu after the http requests?

Where else can I place Sub FillDrawer ?? I tried putting in another place but overwrites it over and over again.

Thanks in advance
 
Upvote 0

Christian García S.

Active Member
Licensed User
Erel,

I tried removing the part where it calls HTTP Job, since the table was already full, now the menu is always loaded.

But then I do not have something clear in the concept of wait for.

It is assumed that "wait for" expects the entire http request to be loaded or terminated to continue with the next step, in this case Fill Drawer.

can you can clarify me a bit, because in this part I am confused, in the log that I puted in the previous post you see how the http request is loaded and then the FillDrawer function is called, it is strange.

Thanks in advance
 
Upvote 0
Top