私は、Xamarin Androidで開発されたAPPを完備しています。 IOS Xamarinのバージョンを行っていますが、非同期のオフラインAzureをアクティブにするのに問題があります。 testoデバイスが次のエラーを生成すると、エミュレータが動作します。Xamarin/IOS/Azure - タイプに「id」のメンバーが見つかりません
"タイプ 'FM.Model.Categoria'に" id "のメンバーが見つかりません。"
using Microsoft.WindowsAzure.MobileServices;
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;
using Microsoft.WindowsAzure.MobileServices.Sync;
using System;
using System.IO;
using System.Threading.Tasks;
namespace FM.Dados
{
public class AtualizaDados
{
static AtualizaDados instance = new AtualizaDados();
const string applicationURL = @"https://xxxx.azurewebsites.net";
private MobileServiceClient client;
private IMobileServiceSyncTable<Model.Categoria> categoriaTable;
private AtualizaDados()
{
try
{
CurrentPlatform.Init();
SQLitePCL.CurrentPlatform.Init();
// Initialize the Mobile Service client with the Mobile App URL, Gateway URL and key
client = new MobileServiceClient(applicationURL);
// Create an MSTable instance to allow us to work with the TodoItem table
categoriaTable = client.GetSyncTable<Model.Categoria>();
}
catch (Exception e)
{
Console.Error.WriteLine(@"Sync Failed: {0}", e.Message);
}
}
public static AtualizaDados DefaultService
{
get
{
return instance;
}
}
public async Task InitializeStoreAsync()
{
try
{
var store = new MobileServiceSQLiteStore(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "fm.db"));
store.DefineTable<Model.Categoria>();
await client.SyncContext.InitializeAsync(store);
}
catch(Exception e)
{
Console.Error.WriteLine(@"Sync Failed: {0}", e.Message);
}
}
public async Task SyncAsync(bool pullData = false)
{
try
{
await client.SyncContext.PushAsync();
if (pullData)
{
await categoriaTable.PullAsync("allCategoria", categoriaTable.CreateQuery());
}
}
catch (MobileServiceInvalidOperationException e)
{
Console.Error.WriteLine(@"Sync Failed: {0}", e.Message);
}
}
}
}
属性「Id」が存在し、それでもエラーが発生します。
私は同じエラーでいくつかのユーザーフォーラムを見たことがありますが、解決策は私の問題を解決しませんでした。 誰でも何ができますか? エミュレータが動作してから何らかの許可が必要ですか?
Adrian Hallさんは、 "store.DefineTable();を実行すると、同じエラーが通知され、生成されました。 InitializeStoreAsync() –
オフラインキャッシュをクリアする必要があるかもしれません - 基本ファイルを削除するだけです。 –
また、フォルダのアクセス権を確認してください。通常、フォルダパスを処理する必要はありません。ファイル名を指定するだけで、適切な場所に配置されます。 –