I am trying to save a list with KeyValueStore but I am getting the following error:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private xui As XUI
Private kvs As KeyValueStore
Private ListStoreData As List
Private B4XComboBox1 As B4XComboBox
Private B4XFloatTextField1 As B4XFloatTextField
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("Page1")
NavControl.ShowPage(Page1)
kvs.Initialize(xui.DefaultFolder, "store")
ListStoreData.Initialize
ListStoreData = kvs.Get("ListaElementos")
B4XComboBox1.SetItems(ListStoreData)
End Sub
Sub Button1_Click
ListStoreData.Add(B4XFloatTextField1.Text)
kvs.Put("ListaElementos", ListStoreData)
B4XComboBox1.SetItems(ListStoreData)
B4XFloatTextField1.Text = ""
xui.MsgboxAsync("Saved", "B4X")
End Sub
B4X:
Copying updated assets files (9)
Application_Start
Error occurred on line: 69 (B4XComboBox)
Object was not initialized (NSArray)
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
B4i Example -[B4IObjectWrapper object] + 120
B4i Example -[B4IList AddAll:] + 100
B4i Example -[b4i_b4xcombobox _setitems::] + 588
B4i Example -[b4i_main _application_start:] + 1316
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1400
B4i Example -[B4IShell runMethod:] + 420
B4i Example -[B4IShell raiseEventImpl:method:args::] + 1968
B4i Example -[B4IShellBI raiseEvent:event:params:] + 1360
B4i Example __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
B4i Example main + 104
libdyld.dylib <redacted> + 4
)
Application_Active