B4i Library Key Value Store works on Device but not on Simulator

When I run Key Value Store on Simulator (on device is OK) then I always get NULL as the operation result of:

result=kvsM.Get("sthStoredInKVS")

Am I making some mistake while running program on Simulator?
 

tufanv

Expert
Licensed User
Longtime User
Keyvaluestore is not related to apple account that is keychain.
It should work on simulator , how do you initialize the keyvaluestore and how do you put information , can you paste your code ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works fine here with the simulator. Tested with this code:
B4X:
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Private kvs As KeyValueStore
End Sub

Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)
   kvs.Initialize(File.DirDocuments, "test.dat")
   Log(kvs.GetDefault("test", "N/A"))
   kvs.Put("test", "alskdjalksdj")
End Sub

I can only guess that your simulator deletes the previous app data when you reinstall it for some reason.
 
Top