Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unity:如何解决Firebase.Storage.StorageException?_Firebase_Unity3d_Firebase Storage - Fatal编程技术网

Unity:如何解决Firebase.Storage.StorageException?

Unity:如何解决Firebase.Storage.StorageException?,firebase,unity3d,firebase-storage,Firebase,Unity3d,Firebase Storage,我正在尝试使用firebase存储上载图像。 这是我试过的 public void firetalk(string path) { Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance; Firebase.Storage.StorageReference storage_ref = storage.

我正在尝试使用firebase存储上载图像。 这是我试过的

 public void firetalk(string path)
        {

            Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance;

            Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl("gs://<myurl>.appspot.com/");

            Firebase.Storage.StorageReference art_image_ref = storage_ref.Child("images/innocence.jpg");

            art_image_ref.PutFileAsync(path).ContinueWith((Task<StorageMetadata> task) =>
            {
                if (task.IsFaulted || task.IsCanceled)
                {
                    Debug.Log(task.Exception.ToString());
                    // Uh-oh, an error occurred!
                }
                else
                {
                    // Metadata contains file metadata such as size, content-type, and download URL.
                    Firebase.Storage.StorageMetadata metadata = task.Result;
                    string download_url = metadata.DownloadUrl.ToString();
                    Debug.Log("Finished uploading...");
                    Debug.Log("download url = " + download_url);
                }
            });
        }

有客人吗?

你应该包括你的firestore安全规则。@AndréKool怎么做?在安全规则中,我有服务
firebase.storage{match/b/{bucket}/o{match/{allpath=**}{allow read,write:if request.auth!=null;}}}}}
您的规则声明您需要进行身份验证。这就是你被拒绝许可的原因。
System.AggregateException: Exception of type 'System.AggregateException' was thrown.
-----------------
Firebase.Storage.StorageException: Permission denied. Could not perform this operation
UnityEngine.Debug:Log(Object)
GracesGames.SimpleFileBrowser.Scripts.explorer_script:m__0(Task`1) (at Assets/scripts/explorer_script.cs:85)
System.Threading.Tasks.TaskCompletionSource`1:SetException(Exception)
Firebase.Storage.StorageReference:CompleteTask(Task`1, TaskCompletionSource`1, Func`1, String, Boolean)
Firebase.Storage.c__AnonStorey6:<>m__0(Task`1)
System.Threading.Tasks.TaskCompletionSource`1:SetException(Exception)
Firebase.Storage.c__AnonStorey0:<>m__0()
Firebase.Storage.Future_StorageMetadata:SWIG_CompletionDispatcher(Int32)
Firebase.AppUtilPINVOKE:PollCallbacks()
Firebase.AppUtil:PollCallbacks()
Firebase.Platform.FirebaseAppUtils:PollCallbacks()
Firebase.Platform.FirebaseHandler:Update()
Firebase.Platform.FirebaseMonoBehaviour:Update()