I'm trying to use ServiceStack clients in a XAMAIN iOS project, and when debugging it, I have the following exception:
"System.ArgumentException: PclExport.Instance must be initialized."
The code that throws the exception is as follows:
try { string strReadParam = this.xmlParser.GetString("SyncUrl"); CommonStatic.SyncWSUrl = strReadParam; var client = new JsonServiceClient(CommonStatic.SyncWSUrl); client.Timeout = new TimeSpan(0, 0, 0, 5, 0); var response = client.Get(new mSalesCheckConnectionRequest { DBSource = CommonStatic.DBSource, DBSourceInstance = CommonStatic.DBSourceInstance, DBName = CommonStatic.DBName, DBUsername = CommonStatic.DBUsername, DBPassword = CommonStatic.DBPassword }); return; } catch (System.Net.WebException wex) { }
I use ServiceStack.Interfaces, ServiceStack.Client.Pcl and ServiceStack.Text.Pcl, having version 4.0.34. In addition, I referenced Newtonsoft.Json in version 6.0.7.
After some research, I realized that the PCL provider for iOS was not automatically registered, so I added "IosPclExportClient.Configure ();" before creating a new Json service client and I referenced ServiceStack.Pcl.iOS.dll in version 4.0.0.0.
As a result, the following error occurs: "You cannot include both" monotouch.dll "and" Xamarin.iOS.dll "in the same Xamarin.iOS project -" Xamarin.iOS.dll "is explicitly specified, and" monotouch.dll "is referenced on "ServiceStack.Pcl". iOS, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = null '. "
Are there any suggestions to solve this problem?
Thank you in advance