iOS Question KeyValueStore not storing?

Yvon Steinthal

Active Member
Licensed User
Hi all,

I believe it might be my misunderstanding of the library but i will post my question.

I am trying to store a list using the KeyValueStore to avoid having to get it from the server numerous times.
Its working. The first time it will get the list from the server, and the other times will get it locally.

However once i quit the app, its as if nothing was stored, i can't get the list back... Help?

Here's parts of my "setting the list" code...

B4X:
'Setting the list as "root" from my http call if "OptoLensListLocal" was null
Dim parser As JSONParser
     parser.Initialize(result)
     Dim root As List = parser.NextArray
   
     kvs.Initialize(File.dirdocuments,"OptoLensListLocal")
   
     
     If(kvs.Get("OptoLensListLocal")=Null)Then
       kvs.PutEncrypted("OptoLensListLocal",root,"x123y")
     End If

Here's when i check BEFORE my http call

B4X:
If(kvs.GetEncrypted("OptoLensListLocal","x123y")<>Null)Then
'Getting localized list
else
'Fetch from server
end if

Would it be because of my File.dirDocuments ?

Thanks.

Y.
 

Yvon Steinthal

Active Member
Licensed User
I am using KVS2 and the Log(kvs.listkeys) is empty when i restart the app.
Both in Debug and Release modes.

EDIT: I decided to go with RandomAccess Library and the Writeb4xObjext/ReadB4xObject , i can't encrypt because i am using v1.27 instead of the last v1.30 (can't find working link) but it will do for now.
 
Last edited:
Upvote 0
Top