iOS Question Object was not initialized (UIView)

jefflynn1974

Member
Licensed User
Longtime User
Hi there
I wrote this code some months ago and I'm sure it was working back then. Something must have changed because now it crashes at the line pg.RootPanel.LoadLayout. It says 'Object was not initialized (UIView)' but what object?

B4X:
Sub Show(date As String)
    DateTime.DateFormat = "yyyy-M-dd"
    DateTime.TimeFormat = "HH:mm:ss"

    DatePicker1.Initialize("")

    If Main.App.OSVersion >= 13.4 Then
        Dim no As NativeObject = DatePicker1
        no.SetField("preferredDatePickerStyle", 1)
    End If

    If pg.IsInitialized = False Then
        pg.Initialize("pg")
        pg.Title="xxx"
        pg.RootPanel.LoadLayout("datepicker")    'crashes here
    End If
    
    DatePicker1.Ticks = DateTime.DateParse(date)
    Main.NavControl.ShowPage(pg)
End Sub

Here is the full log.
Log:
Error occurred on line: 26 (datepicker)
Object was not initialized (UIView)
Stack Trace: (
  CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 1157612
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 120016
  FindMe               -[B4IObjectWrapper object] + 136
  FindMe               -[B4IViewWrapper setTop:] + 52
  FindMe               -[LS_datepicker LS_general:::] + 200
  CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 1175856
  CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 8656
  FindMe               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
  FindMe               +[B4ILayoutBuilder runScripts:::] + 980
 FindMe               -[B4ILayoutBuilder loadLayout:::] + 2312
 FindMe               -[B4IPanelWrapper LoadLayout::] + 204
 FindMe               -[b4i_datepicker _show:] + 1872
 FindMe               -[b4i_main _enddatelabel_click] + 460
 CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 1175856
 CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 8656
 FindMe               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
 FindMe               -[B4IShell runMethod:] + 448
 FindMe               -[B4IShell raiseEventImpl:method:args::] + 2172
 FindMe               -[B4IShellBI raiseEvent:event:params:] + 1580
 FindMe               __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
 libdispatch.dylib    04B54A98-8EAD-371E-8C12-AD116CB118E2 + 393880
 libdispatch.dylib    04B54A98-8EAD-371E-8C12-AD116CB118E2 + 397952
 libdispatch.dylib    04B54A98-8EAD-371E-8C12-AD116CB118E2 + 65628
 CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 632288
 CoreFoundation       6FD5304A-9759-3E22-A863-456EAB55F4CC + 608904
 CoreFoundation       CFRunLoopRunSpecific + 572
 GraphicsServices     GSEventRunModal + 160
 UIKitCore            3405666F-F281-3F71-BA86-83E5A27AB5B0 + 11723736
 UIKitCore            UIApplicationMain + 164
 FindMe               main + 128
 libdyld.dylib        FC5D448B-5EE3-3786-86E7-CCE6C21A212B + 5480
)
 
Top