FIRStorageErrorDomain Code=-13010:UIImageView未加载,控制台提示对象不存在
Fixing FIRStorageErrorDomain Code=-13010 ("Object images does not exist")
Hey there, let's work through why you're hitting this Firebase Storage error and get your UIImageView populated with the image.
1. Break Down the Error
That -13010 code maps directly to StorageErrorCode.objectNotFound — Firebase can't find the object you're trying to download. The message "Object images does not exist" gives us two key clues:
- You're pointing to a storage path that doesn't actually exist in your bucket
- Or you're trying to download a folder instead of a specific image file (Firebase Storage doesn't support downloading entire folders directly)
2. Fix the Path Issues in Your Code
Looking at your snippet, there are two clear missteps:
- You define
gsReferencepointing topost-pics/but never use it — instead, you usestorageRef.child("images/"), which likely points to the root of your bucket, not thepost-picssubdirectory you intended. - You're targeting the
images/folder itself, not a specific image file inside it.
Here's the corrected code, with comments explaining the changes:
// Download image let storage = Storage.storage() // Point to your intended base directory: post-pics/ let postPicsRef = storage.reference(forURL: "gs://myaddress.appspot.com/post-pics/") // Target a specific image file inside the images folder (replace with your actual filename) let imageStorageRef = postPicsRef.child("images/your-image-filename.jpg") imageStorageRef.getData(maxSize: 2 * 1024 * 1024) { data, error in if let error = error { print("******** \(error)") } else { // Don't forget to assign the image to your UIImageView! if let image = UIImage(data: data!) { yourImageView.image = image } } }
3. Quick Verification Steps
- Double-check your Firebase Storage console: Confirm the path
post-pics/images/your-image-filename.jpgexists. If the folder or file is missing, upload it first. - Make sure
yourImageViewis properly connected to your storyboard/XIB (or initialized programmatically) — otherwise, even a successful download won't show anything. - If you're using
storageRefelsewhere, confirm it's initialized correctly. For the default bucket,Storage.storage().reference()works, but always chain in subdirectories likepost-pics/to target the right location.
内容的提问来源于stack exchange,提问作者user9210345
相关产品推荐
相关产品推荐

