如何在Xamarin.iOS Azure移动应用程序中存储帐户信息?

时间:2016-03-14 23:08:17

标签: xamarin.ios azure-mobile-services

我使用Twitter对Azure移动应用中的用户进行身份验证。我想在手机上保存帐户信息,以便用户无需在每次应用启动时登录。它是一个Xamarin.iOS应用程序。

如果我正在构建Windows应用程序,请按照the Azure Mobile Apps documentation under "Caching the authentication token"中的说明使用PasswordVault。

如果我使用Xamarin.Auth,我会按照the Xamarin.Auth documentation under "Storing and Retrieving Account Information on Devices"中的说明使用AccountStore

我看到Azure移动应用SDK包含a modified version of the Xamarin.Auth plugin。我可以这样使用AccountStore吗?

如果没有,在Xamarin.iOS中保存帐户信息的最佳方式是什么?

1 个答案:

答案 0 :(得分:0)

答案是使用iOS Keychain。我忘记了Xamarin.Auth是开源的。以下是它存储帐户的方式:

https://github.com/xamarin/Xamarin.Auth/blob/master/src/Xamarin.Auth.iOS/KeyChainAccountStore.cs

还有来自Xamarin的Keychain样本:

https://github.com/xamarin/monotouch-samples/blob/master/Keychain/Main.cs