Agat
Agat

Reputation: 4779

Akavache: saved value not available after iOS app restart

I am using Akavache standard approach on iOS (actually, it's .NET Standard project for Android/iOS), but the issue appears with iOS only.

I save some value during the app lifecycle:

    await BlobCache.Secure.InsertObject("user", user);

And on the app new session this:

    var user = await BlobCache.Secure.GetObject<UserModel>("user");

But the object is not available (with KeyNotFoundException exception).

Recently I also was trying to call BlobCache.Secure.Flush().Wait() right after the object saving, but there is still no effect.

The issue happens with iOS only. Android is fine. The issue happens with both Secure and UserAccount objects.

The data is not available even after "gentle" BlobCache.Shutdown().Wait() on the application closing. So, have no idea even where to search the solution now.

Any thoughts why might cause this issue and how I can solve it?

Upvotes: 2

Views: 844

Answers (2)

Simon Corcos
Simon Corcos

Reputation: 1022

There's another issue people have had is that the SqlLite cache is getting linked out. If you check the type on LocalMachine and it's of type MemoryCache that won't be resilient.

Just add the linker static class somewhere in your project (even if it's a PCL or Standard lib).

That worked for me.

Upvotes: 1

Qonstrukt
Qonstrukt

Reputation: 194

Did you set the ApplicationName property on BlobCache? On iOS this seems more of a necessity than on Android it seems.

Upvotes: 0

Related Questions