SecureStorage - Fails on iOS

mdecoomdecoo Member ✭✭
edited December 2018 in Cross Platform with Xamarin

Hi Everyone,

I'm using Xamarin Essentials SecureStorage with Xamarin Forms. (Nice solution for cross platform saving :smiley:)

try
      {
              await SecureStorage.SetAsync("access_Token", Settings.AccessToken.ToString());
                  await SecureStorage.SetAsync("access_TokenExpirationDate", Settings.AccessTokenExpirationDate.ToString());
           }

It's set's the token and expiration of the token on the local device so relogin and check is fast.
If I use this on Android it works perfectly. It worked before on iOS (only once though, changed some settings and now it does not work. Cannot find why.)

This is the exception message:

{System.Exception: Error adding record: MissingEntitlement at Xamarin.Essentials.KeyChain.SetValueForKey (System.String value, System.String key, System.String service) [0x00061] in C:\agent\_work\69\s\Xamarin.Essentials\SecureStorage\SecureStorage.ios.cs:103 at Xamarin.Essentials.SecureStorage.SetAsync (System.String key, System.String value, Security.SecAccessible accessible) [0x00027] in C:\agent\_work\69\s\Xamarin.Essentials\SecureStorage\SecureStorage.ios.cs:23 at Xamarin.Essentials.SecureStorage.PlatformSetAsync (System.String key, System.String data) [0x00000] in C:\agent\_work\69\s\Xamarin.Essentials\SecureStorage\SecureStorage.ios.cs:37 at Xamarin.Essentials.SecureStorage.SetAsync (System.String key, System.String value) [0x00021] in C:\agent\_work\69\s\Xamarin.Essentials\SecureStorage\SecureStorage.shared.cs:27 at Master.Core.Services.ApiDataService+<LoginAsync>d__1.MoveNext () [0x002d9] in C:\Users\Martijn\Source\Repos\Master\Master\Master.Core\Services\HttpDataService.cs:103 }

The exception says it has something todo or related to Entitlement?

`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "//www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
        <string>iCloud.com.Master.Master</string>
    </array>
    <key>com.apple.developer.ubiquity-kvstore-identifier</key>
    <string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
    <key>com.apple.developer.authentication-services.autofill-credential-provider</key>
    <true/>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.networking.multipath</key>
    <true/>
    <key>keychain-access-groups</key>
    <array>
        <string>com.Master.Master</string>
    </array>
</dict>
</plist>`

As you can see everything is supposed to be as the documentation mentions. Could someone have a look?

Best Answer

Answers

  • mdecoomdecoo Member ✭✭

    @LandLu Thanks, I tried this before because this is also mentioned in the documentation. Yesterday it seems to be working again :smiley:

  • AndyDentAndyDent AUMember ✭✭

    Thanks, this fixes a problem with the Xappy sample

Sign In or Register to comment.