Limitações do XamarinXamarin limitations
O Microsoft. Data. sqlite tem como destino .NET Standard 2,0 e tem suporte no Xamarin.Microsoft.Data.Sqlite targets .NET Standard 2.0 and is supported on Xamarin. A tabela a seguir mostra quais plataformas o pacote SQLitePCLRaw padrão fornece binários do SQLite nativos para o.The following table shows which platforms the default SQLitePCLRaw bundle provides native SQLite binaries for. Consulte versões personalizadas do SQLite para obter detalhes sobre como usar um pacote diferente ou fornecer seus próprios binários do SQLite nativos.See Custom SQLite versions for details on using a different bundle or providing your own native SQLite binaries.
PlataformaPlatform | Binários do SQLiteSQLite binaries |
---|---|
Xamarin.AndroidXamarin.Android | —— |
arm64-v8a |
✔✔ |
armeabi-v7a |
✔✔ |
x86 |
✔✔ |
x86_64 |
✔✔ |
Xamarin.iOSXamarin.iOS | ✔✔ |
Xamarin.MacXamarin.Mac | ✔✔ |
Xamarin. TVOSXamarin.TVOS | ✔✔ |
UWPUWP | —— |
arm |
✔✔ |
arm64 |
✔✔ |
x64 |
✔✔ |
x86 |
✔✔ |
iOSiOS
Microsoft. Data. sqlite tenta inicializar automaticamente os pacotes de SQLitePCLRaw.Microsoft.Data.Sqlite tries to automatically initialize SQLitePCLRaw bundles. Infelizmente, devido a limitações na compilação da AOT (antecipadamente de tempo) para Xamarin. iOS, a tentativa falha e você obtém o erro a seguir.Unfortunately, because of limitations in the ahead-of-time (AOT) compilation for Xamarin.iOS, the attempt fails and you get the following error.
Você precisa chamar
SQLitePCL.raw.SetProvider()
.You need to callSQLitePCL.raw.SetProvider()
. Se você estiver usando um pacote de pacotes, isso é feito chamandoSQLitePCL.Batteries.Init()
.If you're using a bundle package, this is done by callingSQLitePCL.Batteries.Init()
.
Para inicializar o pacote, adicione a seguinte linha de código ao seu aplicativo antes de usar o Microsoft. Data. sqlite.To initialize the bundle, add the following line of code to your app before using Microsoft.Data.Sqlite.
SQLitePCL.Batteries_V2.Init();