我正在使用 Xamarin.Forms 开发一个跨平台项目。在我的项目中,我使用 API 通过用户名和密码登录。当我尝试登录 Android 和 UWP 平台时,它运行良好。但是当我想登录我的 iOS 项目时,它会抛出一个异常:
在 System.Reflection.Emit.DynamicMethod..ctor (System.String 名称,
System.Type 返回类型、System.Type[] 参数类型、System.Type
所有者,System.Boolean skipVisibility) [0x00006] 中
/Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.11/src/Xamarin.iOS/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.notsupported.cs:62
在
Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod
(System.String 名称、System.Type returnType、System.Type[]
参数类型,System.Type 所有者)[0x00000] 中
/_/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs:45
在 Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T]
(System.Type 类型) [0x00000] 中
/_/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs:244
在
Newtonsoft.Json.Serialization.DefaultContractResolver.GetDefaultCreator
(System.Type 创建类型) [0x00000] 中
/_/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:780
在
Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract
(Newtonsoft.Json.Serialization.JsonContract 合约)[0x0008b] 中
/_/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:813
在
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract
(System.Type objectType) [0x00007] 中
/_/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:340
在
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract
(System.Type objectType) [0x0010f] 中
/_/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:1249
在
System.Collections.Concurrent.ConcurrentDictionary2[TKey,TValue].GetOrAdd
(TKey key, System.Func
2[T,TResult] valueFactory) [0x00034] 中
/Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.11/src/Xamarin.iOS/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs:1003
在 Newtonsoft.Json.Utilities.ThreadSafeStore`2[TKey,TValue].Get (TKey
键)[0x00000] 中
/_/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs:64
在
Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract
(System.Type 类型) [0x0000b] 中
/_/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:198
在
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe
(System.Type 类型) [0x0000b] 中
/_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:133
在
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize
(Newtonsoft.Json.JsonReader 阅读器、System.Type 对象类型、
System.Boolean checkAdditionalContent) [0x0000e] 中
/_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:143
在 Newtonsoft.Json.JsonSerializer.DeserializeInternal
(Newtonsoft.Json.JsonReader 阅读器,System.Type 对象类型)[0x00046]
在 /_/Src/Newtonsoft.Json/JsonSerializer.cs:907
在
Newtonsoft.Json.JsonSerializer.反序列化(Newtonsoft.Json.JsonReader
读卡器,System.Type objectType) [0x00000] 中
/_/Src/Newtonsoft.Json/JsonSerializer.cs:886
在
Newtonsoft.Json.JsonConvert.DeserializeObject(System.String值,
System.Type类型、Newtonsoft.Json.JsonSerializerSettings设置)
[0x0002d] 在 /_/Src/Newtonsoft.Json/JsonConvert.cs:830
在
Newtonsoft.Json.JsonConvert.DeserializeObject[T](System.String值,
Newtonsoft.Json.JsonSerializerSettings 设置)[0x00000] 中
/_/Src/Newtonsoft.Json/JsonConvert.cs:786
在
Newtonsoft.Json.JsonConvert.DeserializeObject[T](System.String 值)
[0x00000] 在 /_/Src/Newtonsoft.Json/JsonConvert.cs:719
在
Restaurant.Core.DataServices.LoginDataService+d__0.MoveNext ()
[0x00222] 在
C:\Projects\Restaurant\Restaurant\Restaurant.Core\DataServices\LoginDataService.cs:44
--- 从先前抛出异常的位置开始的堆栈跟踪结束 ---
在
Restaurant.Core.ViewModels.Login.LoginViewModel+d.MoveNext
() [0x00058] 中
C:\Projects\Restaurant\Restaurant\Restaurant.Core\ViewModels\Login\LoginViewModel.cs:78
--- 从先前抛出异常的位置开始的堆栈跟踪结束 ---
在
Restaurant.Core.Helpers.ExceptionHandler+d__3.MoveNext
() [0x000f6] 中
C:\Projects\Restaurant\Restaurant\Restaurant.Core\Helpers\ExceptionHandler.cs:38