0

I'm currently using Visual Studio Mac 2019 for to build my iOs Xamarin Forms Application.

My Application Akavache to store persistent data specifically credentials which I utilizes its BlobCache.Secure storage, but sadly the data doesn't persist.

I found that I should add either of the following: 1. Linker Class

using System;
using Akavache.Sqlite3;

namespace NameSpace.iOS
{
    [Preserve]
    public static class LinkerPreserve
    {
        static LinkerPreserve()
        {
            var persistentName = typeof(SQLitePersistentBlobCache).FullName;
            var encryptedName = typeof(SQLiteEncryptedBlobCache).FullName;
        }
    }

    public class PreserveAttribute : Attribute
    {
    }
}

or

2. Initializer

Akavache.Registrations.Start("FollowTheDrop");

Akavache: saved value not available after iOS app restart

but every time I add the solution above the following error below occurs during the build

MTOUCH : error MT2101: Can't resolve the reference 'System.Int32 SQLitePCL.raw::sqlite3_bind_blob(SQLitePCL.sqlite3_stmt,System.Int32,System.Byte[])', referenced from the method 'System.Void Akavache.Sqlite3.BulkInsertSqliteOperation/<>c__DisplayClass7_0::b__0()' in 'SQLitePCLRaw.core, Version=1.1.13.388, Culture=neutral, PublicKeyToken=1488e028ca7ab535'.

Am I missing something that causes this error?

lancelot
  • 21
  • 4

1 Answers1

0

It was solved by updating the following Nuget Packages below which has dependencies on each other:

  1. Akavache 9.0.1
  2. Splat 14.3.1
  3. fusillade 2.4.47

Lastly when adding the linker static class consider adding a Preserve Attribute as shown below:

[Preserve]
public static class LinkerPreserve
{
    static LinkerPreserve()
    {
        var persistentName = typeof(SQLitePersistentBlobCache).FullName;
        var encryptedName = typeof(SQLiteEncryptedBlobCache).FullName;
    }
}

public class PreserveAttribute : Attribute
{
}
lancelot
  • 21
  • 4