diff --git a/Storage/Storage/Internal/Storage/StorageController.cs b/Storage/Storage/Internal/Storage/StorageController.cs index 3a79c50..551d0ab 100644 --- a/Storage/Storage/Internal/Storage/StorageController.cs +++ b/Storage/Storage/Internal/Storage/StorageController.cs @@ -50,13 +50,15 @@ namespace LeanCloud.Storage.Internal.Storage { return null; } - public void Delete(string filename) { + public Task Delete(string filename) { if (storage == null) { - return; + return Task.CompletedTask; } string path = GetFileFullPath(filename); - IOFile.Delete(path); + return Task.Run(() => { + IOFile.Delete(path); + }); } private string GetFileFullPath(string filename) { diff --git a/Storage/Storage/LCUser.cs b/Storage/Storage/LCUser.cs index abca204..0f4e29a 100644 --- a/Storage/Storage/LCUser.cs +++ b/Storage/Storage/LCUser.cs @@ -89,7 +89,7 @@ namespace LeanCloud.Storage { currentUser = ParseObject(data) as LCUser; } catch (Exception e) { LCLogger.Error(e); - LCInternalApplication.StorageController.Delete(USER_DATA); + await LCInternalApplication.StorageController.Delete(USER_DATA); } } return currentUser; @@ -513,8 +513,7 @@ namespace LeanCloud.Storage { public static Task Logout() { currentUser = null; // 清理持久化数据 - LCInternalApplication.StorageController.Delete(USER_DATA); - return Task.FromResult(null); + return LCInternalApplication.StorageController.Delete(USER_DATA); } ///