我下载了QuickJournal示例应用。设置我的帐户并在Realm Cloud中添加用户。 之后,我添加了这个简单的代码来登录用户。
Uri authURL = new Uri("$$InstanceUrlHere");
Credentials credentials = Credentials.UsernamePassword(“Ali”, “123”, createUser: false);
try
{
//trying to login using realm default authticaion: username and password
var user = await User.LoginAsync(credentials, authURL);
await Application.Current.MainPage.DisplayAlert(“Confirmation”, "User Identitiy from Realm Login: " + user.Identity, “Ok”);
}
catch(Exception ex)
{
await Application.Current.MainPage.DisplayAlert(“Error”, “Error while Trying to login”, “Ok”);
System.Diagnostics.Debug.WriteLine("Error while Trying to login: " + ex);
}
代码在Android模拟器上正常运行。但是,在iOS上,我在LoginAsync步骤中收到以下错误:
System.TypeInitializationException: The type initializer for ‘Realms.Sync.SharedRealmHandleExtensions’ threw an exception. —> System.EntryPointNotFoundException: realm_install_syncsession_callbacks
at (wrapper managed-to-native) Realms.Sync.SharedRealmHandleExtensions+NativeMethods.install_syncsession_callbacks(Realms.Sync.SharedRealmHandleExtensions/NativeMethods/RefreshAccessTokenCallbackDelegate,Realms.Sync.SharedRealmHandleExtensions/NativeMethods/SessionErrorCallback,Realms.Sync.SharedRealmHandleExtensions/NativeMethods/SessionProgressCallback,Realms.Sync.SharedRealmHandleExtensions/NativeMethods/SessionWaitCallback)
at Realms.Sync.SharedRealmHandleExtensions…cctor () [0x0004e] in :0
我发现了这个类似的问题,但它已经过时了,并没有帮我解决问题:
realm in Xamarin, System.EntryPointNotfoundException when trying to use realm