0

I'm working on an iCloud-enabled core data app. One of my managed objects has a transformable attribute that I use to store an image, which I define as a UIImage in the class header file. This approach worked perfectly in an earlier non-iCloud version, and seems to work on the device (iPhone 5 w/ iOS 7) that I use to create a new entity with an image.

But on a peer device (an iPad running iOS 8), iCloud is not making the images available, even though the entities are otherwise intact. In debugger, there's an address for a UIImage as a property of the object, but there's no image. The images are not large: just .jpgs of max 50kB.

Probably related, the app on the iPad takes a very long time to log "using local storage: 0" and I get the warning "Download failed for file, error: Error Domain=NSCocoaErrorDomain Code=512 "The file download timed out." (No problems on the iPhone.) Other posts mention this but I haven't found a clear answer other than "it's an iCloud issue". In general, iCloud sharing between my devices works frustratingly slowly and irregularly.

Any ideas on what is happening here? I'm using what I think is a pretty standard iCloud core data stack so I didn't want to take up the space posting that yet...

Henry95
  • 623
  • 6
  • 16
  • My guess is that iCloud is just taking a long time to upload/download the image data. In my view, it should not integrate the changes until that data is available, but it seems to do that anyway. Odd. If the app isn't yet in the store with iCloud sync, you could consider other options like Ensembles, which allow you to use CloudKit, which is more predictable for data transfer. (Disclosure: I develop Ensembles) – Drew McCormack Oct 15 '14 at 08:27
  • Drew, thanks. I've discovered that the problem isn't iCloud related: I removed iCloud, and core data is making the images nil upon app termination. (Yes, I'm saving the context when it enters background.) I'm going to post a new question on that. iCloud core data sync is still driving me crazy so I'll be shipping without it this version. Ensembles is looking attractive for my next try... – Henry95 Nov 08 '14 at 17:00

1 Answers1

0

The missing images turned out to be a core data issue, not an iCloud issue (although I'm still wrestling with iCloud). The problem was that I was setting the UIImage properties of my managed objects with direct references to images in my bundle, instead of new UIImage objects generated from those images. (Full answer here.) With iOS 8, the images did not persist to core data upon app termination.

Community
  • 1
  • 1
Henry95
  • 623
  • 6
  • 16