iOS Question Solved - AStabmenu error empty array

tsteward

Well-Known Member
Licensed User
Longtime User
Astabmenu working perfect on B4A but error on B4I. there seems to be an empty array for some reason. Any suggestions on what to look for or how to fix appreciated.

Error:
Error occurred on line: 997 (ASTabMenu)
*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
LARA 4 -[B4IPanelWrapper GetView:] + 92
LARA 4 -[B4XViewWrapper GetView:] + 104
LARA 4 -[b4i_astabmenu _settab::::] + 720
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
LARA 4 +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
LARA 4 -[B4IShell runMethod:] + 448
LARA 4 -[B4IShell raiseEventImpl:method:args::] + 2172
LARA 4 -[B4IShellBI raiseEvent:event:params:] + 1580
LARA 4 +[B4IDebug delegate:::] + 80
LARA 4 -[b4i_astabmenu _settab::::] + 548
LARA 4 -[b4i_b4xpagecarmodels _clvmodels_itemclick:::] + 3644
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
LARA 4 +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
LARA 4 -[B4IShell runMethod:] + 448
LARA 4 -[B4IShell raiseEventImpl:method:args::] + 2172
LARA 4 -[B4IShellBI raiseEvent:event:params:] + 1580
LARA 4 -[B4ICommon CallSub4::::] + 316
LARA 4 -[B4ICommon CallSub3:::::] + 460
LARA 4 -[ResumableSub_customlistview_PanelClickHandler resume::] + 1944
LARA 4 -[b4i_customlistview _panelclickhandler:] + 184
LARA 4 -[b4i_customlistview _panel_click] + 224
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
LARA 4 +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
LARA 4 -[B4I raiseEvent:event:params:] + 548
LARA 4 __33-[B4I raiseUIEvent: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
LARA 4 main + 128
libdyld.dylib <redacted> + 4
My Code
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("carLayout")
    dialog.Initialize(Root)
    dialog.BlurBackground = True

    remoteProc.Initialize
    
    'add menu items
    
    #if B4A
    'AddMenuItem(0xF0C9, "additionalMenu")
    Dim rwv As Reflector
    rwv.Target = WVCar
    rwv.Target = rwv.RunMethod("getSettings")
    rwv.RunMethod2("setBuiltInZoomControls", True, "java.lang.boolean")
    rwv.RunMethod2("setDisplayZoomControls", False, "java.lang.boolean")
    #end if
'    #if b4i
'    B4XPages.GetNativeParent(Me).TopRightButtons = Array(CreateFABarButton(Chr(0xF0C9), "additionalMenu"))
'    'B4XPages.GetNativeParent(Me). NavControl.ToolBarVisible = True
'    #End If

    CarMenuBitmap = xui.LoadBitmap(File.DirAssets, "info.png")
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 32dip, 32dip)
    IconCanvas.Initialize(p)
    UpdateMenuItems
    
    #If B4I
    Sleep(450)
    #End If
    currentTab = 0
    ASTabMenu2.BeginUpdate
    ASTabMenu2.AddTab(xui.Color_RGB(97,117, 228),"Info",ASTabMenu2.FontToBitmap(Chr(0xF129),False,30,xui.Color_White),"")
    ASTabMenu2.AddTab(xui.Color_RGB(30,57, 205),"Transponder",ASTabMenu2.FontToBitmap(Chr(0xF2DB),False,30,xui.Color_White),"")
    ASTabMenu2.AddTab(xui.Color_RGB(97,117, 228),"Remote",ASTabMenu2.FontToBitmap(Chr(0xF143),False,30,xui.Color_White),"")
    ASTabMenu2.AddTab(xui.Color_RGB(30,57, 205),"OBD",ASTabMenu2.FontToBitmap(Chr(0xF1E6),False,30,xui.Color_White),"")
    ASTabMenu2.AddTab(xui.Color_RGB(97,117, 228),"+Feedback",ASTabMenu2.FontToBitmap(Chr(0xE87F),True,30,xui.Color_White),"")
    ASTabMenu2.EndUpdate
    ASTabMenu2.TabStripMode = True
    'ASTabMenu1.TabStyle = "TextIcon"
    xui.SetDataFolder("LARA_data")
    
End Sub
 

tsteward

Well-Known Member
Licensed User
Longtime User
I found the error of my ways. Calling routines from another page out of order.

Sorry guys šŸ˜”
 
Upvote 0
Top