简体   繁体   中英

iCloud core data not transferring images

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM