c# - Xamarin.Auth AccountStore not deleting values? -
whenever call method removes accountstore in xamarin, deletes , says there 1 less thing in list. method below called first dependency service.
public void deletesecurevalue(string appname, string key) { var account = accountstore.create().findaccountsforservice(appname).firstordefault(); if (account.properties.containskey(key)) account.properties.remove(key); var props = account.properties; // when debugging, props doesn't contain value passcode }
xamarin.forms.dependencyservice.get<istoragehandler>().deletesecurevalue(globalconstants.app_name, "passcode"); var account = accountstore.create().findaccountsforservice(globalconstants.app_name).firstordefault(); var props = account.properties; // when debugging, props has value passcode when shouldn't
why value passcode seem come back?
you manipulating dictionary in memory in deletesecurevalue
. have write changes storage.
public void deletesecurevalue(string appname, string key) { var store = accountstore.create(); var account = accountstore.create().findaccountsforservice(appname).firstordefault(); if (account.properties.containskey(key)) { account.properties.remove(key); store.save(account, appname); } }
Comments
Post a Comment