Xamarin IOS Simulator KeyChain

Hi Guys,


I have a Xamarin Forms Application running in visual studio, I connect to my MacMini to run an IOS simulator version 10.3

I am using Xamarin Auth to authenticate against Google.

My android application has no problem saving the Refresh Token in the Key Store, but my IOS Application does not store the Refresh Token

In the KeyChain. I am using the Xamarin Auth API Account Store object to store the account information.


I am not sure if I need a developer certificate , or If i need to add something in the Entitlement.plist or add something in the Info.plist.

Please help me I am a bit lost and new to IOS development.

Like I said my code stores in the account information when I test it on an Android Device, but If I run the code on the IOS simulator it does not

store it.


Again I am using Visual Studio 2017 connecting to a MacMini and running an IOS simulator version 10.3 to test the application.

Any insight or thoughts or suggestions would greatley assist me in this matter , google is not much help 😢



Thank you all for reading this.


Kind Regards


AZ

Replies

I had this problem and I noticed that it happens because the simulator configuration of the Xamarin app doesn't have the Entitlement.plist reference. Look my Xamarin.iOS.csproj file:

{...}
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <MtouchArch>x86_64</MtouchArch>
    <MtouchLink>SdkOnly</MtouchLink>
    <MtouchDebug>true</MtouchDebug>
    <CodesignProvision>Automatic</CodesignProvision>
    <CodesignKey>iPhone Developer</CodesignKey>
    // missing Entitlements.plist reference
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\iPhone\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <MtouchArch>ARM64</MtouchArch>
    <CodesignKey>iPhone Developer</CodesignKey>
    <MtouchDebug>true</MtouchDebug>
    <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> // Entitlements.plist reference
    <MtouchLink>None</MtouchLink>
    <MtouchInterpreter>-all</MtouchInterpreter>
  </PropertyGroup>
{...}

Adding <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> to the simulators config was enough to fix it.