I need some help understanding what I am doing incorrectly downloading images that are tied to database references for displaying in a tableview.
I have uploaded images to Firebase Cloud Storage and created a reference in my database. Each database entry can have more than one image so I have a database entry called photos that is an array of url references.
To get the data to display in my tableview I iterate through the database a number of times, so end up with an array of data. For the photos, this is an array containing an array of URL references.
When I tried to get the photo data from this array of arrays using the getData method I got an error message (something about the URL references not beginning with “http:/ or https:/”) which I assumed was because the references were within an array of arrays. I corrected this by using a “For index items in” loop to go through the array of arrays and retrieve the the URLs and append them into a single array.
This allowed me to use the getData method without errors. I retrieved the image data and appended it to an array of images for showing in a tableview.
The problem I am having is that when I try to assign the images in the array to an imageview I get a message saying I am trying to assign a string to a UIIMage.
This tells me that my getData function didn’t work. What should the data look like after I get it?
Following is the array of URLs I created from the array of arrays, that I am using in my getData function. Note: there are only 3 URLs in the array. This looks correct to me.
But following is the data I get from the getData function. NOTE: For some reason there are 5 bits of data.
[<UIImage:0x60000149ec70 anonymous {3000, 2002}>, <UIImage:0x600001490120 anonymous {4288, 2848}>, <UIImage:0x600001498fc0 anonymous {3000, 2002}>, <UIImage:0x600001499200 anonymous {4288, 2848}>, <UIImage:0x600001490000 anonymous {3000, 2002}>]
As always, any help I receive in educating me on coding is greatly appreciated!