首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >为什么GetDownloadUrlAsync()返回“发生未知错误”

为什么GetDownloadUrlAsync()返回“发生未知错误”
EN

Stack Overflow用户
提问于 2019-05-10 03:12:19
回答 1查看 159关注 0票数 0

我找到了其他一些帖子,但没有解决方案,所以我发了这篇文章。

使用firebase示例,我可以将文件上传到firebase存储,但无法使用GetDownloadUrlAsync() -它返回一个未知错误:

代码语言:javascript
复制
GetDownloadUrlAsync: System.AggregateException: One or more errors 
occurred. ---> Firebase.Storage.StorageException: An unknown error 
occurred
--- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.Storage.StorageException: An 
unknown error occurred<---

System.Action`1:Invoke(T)
System.Threading.Tasks.Task:Execute()
System.Threading.ContextCallback:Invoke(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, 
ContextCallback, Object, Boolean)
System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&)
System.Threading.Tasks.Task:ExecuteEntry(Boolean)
System.Threading.ThreadPoolWorkQueue:Dispatch()

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)

这发生在协程中。下面是我的代码:

代码语言:javascript
复制
Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance;
Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl("gs://mystoragelocation.appspot.com");

Firebase.Storage.StorageReference image_ref = storage_ref.Child(file_name);
    var task = image_ref.PutFileAsync(path);

    yield return new WaitUntil(() => task.IsCompleted);
    if (task.IsFaulted) {
        uploadWait.SetActive(false);
        result.text = task.Exception.ToString();
        DebugLog ("Upload Error: " + task.Exception.ToString ());
        throw task.Exception;

    } else {

    storage_ref.GetDownloadUrlAsync().ContinueWith((task2) => {
    if (!task2.IsFaulted && !task2.IsCanceled) {
        DebugLog("Finished uploading... Download Url: " + task2.Result);
    } else {
        DebugLog ("GetDownloadUrlAsync: " + task2.Exception.ToString ());
        }
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56066143

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档