")}.color-scheme--dark .devsite-nav-icon[data-icon=alpha]::before{content:url("data:image/svg+xml;utf8, ")}.devsite-nav-icon[data-icon=beta]::before{content:url("data:image/svg+xml;utf8, ")}.color-scheme--dark .devsite-nav-icon[data-icon=beta]::before{content:url("data:image/svg+xml;utf8, ")}.firebase-platform-label{font:500 12px/24px 'Google Sans',sans-serif}.full-page-selector-dropdown{border:none;position:relative;float:left;display:inline-block}.full-page-selector-dropdown>.ds-selector-tabs{display:none;position:absolute;min-width:160px;z-index:1}.full-page-selector-dropdown:hover .ds-selector-tabs{display:block;margin:0}.full-page-selector-dropdown:hover .kd-tabbutton{display:block;border:none;height:inherit;text-align:left}.full-page-selector-dropdown:hover .kd-buttonbar{border:none;height:inherit}.full-page-selector-dropdown h3:hover{color:var(--tenant-inverted-text-color);background-color:#039be5}.full-page-selector-dropdown:hover .devsite-overflow-menu-button{display:none}img.white-bg{padding:5px;border-radius:2px;background-color:#fff}
提供意見 透過 Apple 平台上的 Cloud Storage 刪除檔案 透過集合功能整理內容 你可以依據偏好儲存及分類內容。
將檔案上傳至 Cloud Storage 後,您也可以刪除檔案。
注意: 根據預設,Cloud Storage for Firebase 值區需要 Firebase Authentication 才能對值區的資料或檔案執行任何動作。您可以將 Firebase Security Rules 變更為 Cloud Storage ,在特定情況下允許未經驗證的存取權 。不過,在大多數情況下,我們強烈建議您限制存取權並設定完善的安全性規則 (尤其是正式版應用程式)。請注意,如果您使用 Google App Engine ,且預設 Cloud Storage 儲存桶的名稱格式為 *.appspot.com
,您可能需要考量安全性規則如何影響 App Engine 檔案的存取權 。 刪除檔案 如要刪除檔案,請先建立該檔案的參照 。然後對該參照呼叫 deleteWithCompletion:
方法。
Swift
// Create a reference to the file to delete
let desertRef = storageRef . child ( "desert.jpg" )
do {
// Delete the file
try await desertRef . delete ()
} catch {
// ...
}
Objective-C
// Create a reference to the file to delete
FIRStorageReference * desertRef = [ storageRef child : @"images/desert.jpg" ];
// Delete the file
[ desertRef deleteWithCompletion :^ ( NSError * error ){
if ( error != nil ) {
// Uh-oh, an error occurred!
} else {
// File deleted successfully
}
}];
注意: 刪除檔案後即無法復原。如果您想還原已刪除的檔案,請務必備份檔案,或在 Cloud Storage 值區啟用物件版本管理功能 。 處理錯誤 檔案刪除作業可能會發生錯誤,原因有很多,包括檔案不存在,或是使用者沒有權限刪除所需檔案。如要進一步瞭解錯誤,請參閱文件中的「處理錯誤 」一節。
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-05-08 (世界標準時間)。
想進一步說明嗎? [[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-05-08 (世界標準時間)。"],[],[]]