Image Playground files suddenly not available

My app lets you create images with Image Playground. When the user approves an image I move it to the documents dir from the temp storage. With over a year of usage I’ve created a lot of images over time.

Out of nowhere the app stopped loading my custom creations from Image Playground saying it couldn’t find the files. It still had my VoiceOver strings I had added for each image and still had the custom categories I assigned them.

Debug code to look in the docs dir doesn’t find them. I downloaded the app’s container and only see the images I created as a test after the problem started.

But my ~70MB app is still taking up 300MB on my iPhone so it feels like they’re there but not accessible.

Is there anything else I can try?

Hi @shiftingsand,

If I'm understanding correctly, the issue has to do with the loading of image data from your app's documents directory, and is not necessarily an issue related to Image Playgrounds itself.

Can you provide code excerpts of how you're writing and reading the image data to and from disk? That may be the best place to start.

Best,

-J

Thanks for the reply and sorry for the delay. That’s correct, these are all images that were created with Image Playground but Image Playground is out of the picture as far as this issue is concerned.

When Image Playground returns the image we get back a temp URL. From that I grab the filename:

tmpURL.lastPathComponent

Then I get the Docs dir and move the image there.

    guard let documentsDirectory = globalFileManager.urls(for: .documentDirectory, in: .userDomainMask).first else {

    let destinationURL = documentsDirectory.appendingPathComponent(filename)

try globalFileManager.moveItem(at: tmpURL, to: destinationURL)

I save the new URL and use it to load the image when needed. I’ve still got all the URLs (and the VoiceOver descriptions that were added to any images) but the files themselves aren’t found any more. That does correspond to me not seeing them when I look at the app’s container. Although I do see the single test image I created after I noticed this problem.

Image Playground files suddenly not available
 
 
Q