Crashing at AccountStore.Create ().Save (e.Account

2019-02-21 23:48发布

问题:

In the Xamarin.Forms example ToDoAwsAuth at

https://developer.xamarin.com/guides/xamarin-forms/web-services/authentication/oauth/

After successful login, in aOnAuthenticationCompleted event, the application is crashing when trying to save to Xamarin.Auth at

AccountStore.Create ().Save (e.Account, "ToDoList");

The error says not able to say to keychain

Looking forward for help.

回答1:

See if you have a file called Entitlements.plist if so click on it and check Enable Keychain

or

create a new file names Entitlements.plist with the following content then drag and drop it on your project

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>keychain-access-groups</key>
    <array>
        <string>your bundle id</string>
    </array>
</dict>
</plist>
  • Right click on your project

  • Choose Options

  • Choose iOS Bundle Signing

  • Choose Entitlements.plist

Thats all then it should be fine !



回答2:

Looks like this is a bug in Xamarin.Auth as per this

https://github.com/xamarin/Xamarin.Auth/issues/128



回答3:

Just add empty Entitlements.plist to your iOS app project.

Select(iOS App Project) /+ File /+ New File /+ iOS /+ Entitlements.plist

Note: this seems to be result of one bug in Xamarin.Auth and Apple's changes in iOS 10 SDK (some report bug in simulator).

Xamarin.Auth fix will be released within next few hours (CI servers) in nuget version 1.3.3-alpha-01

Similar error (bug in Xamarin.Auth) can happen if the authentication is performed while the screen is being locked. PR 80

Related:

https://github.com/xamarin/Xamarin.Auth/issues/128
https://bugzilla.xamarin.com/show_bug.cgi?id=43514

https://github.com/xamarin/Xamarin.Auth/pull/80