Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

akavache not caching in ios simulator/device

ahmedElsayedahmedElsayed USMember ✭✭
edited August 2018 in Xamarin.Forms

using xamarin forms v.3.1 and akavache v5 + akavache.sqlite3 v5.

in app.xaml.cs I initialized akavache

       BlobCache.ApplicationName = "EF_Cache";
       BlobCache.EnsureInitialized();

And to cache data i use localmachine

`   await BlobCache.LocalMachine.InsertObject<List<int>>("FavouriteTeams", FavouriteTeam, TimeSpan.FromDays(300));`

To retrieve data i do

 `  var FavouritesList = await BlobCache.LocalMachine.GetObject<List<int>>("FavouriteTeams");`

The following code works fine in android devices with no issue but when i tried it on ios device/simulator it fails with no errors, the getobject<> just return null when restarting the app.

is there any thing is missing or an extra thing should be configured in ios apps in properties or info.plist.

Answers

  • ahmedElsayedahmedElsayed USMember ✭✭
    edited August 2018

    solved by adding that class to ios project

    public static class LinkerPreserve
    {
      static LinkerPreserve()
      {
        var persistentName = typeof(SQLitePersistentBlobCache).FullName;
        var encryptedName = typeof(SQLiteEncryptedBlobCache).FullName;
      }
    }
    
Sign In or Register to comment.