Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

xcode - Photo collection in core data

I am currently building an iOS app that lets users make collections from photos that get imported from their device photos. I am using core data as the data store and have questions about best patterns and practices to do this.

If I sound naive, I assure you it is because I am ;)

In a perfect world, my users will be importing hundreds of photos and I would like to backup app data (and photos) to iCloud.

So far, I see a few paths all with their own pros and cons:

  1. Store the photo itself in core data. This seems very doable by using a 'data' type in the entity. This feels clean but wouldn't this create duplicate data on the device and potentially be very bloaty?

  2. Create an album in Photos, place imported photos in it, and save local/device URLs in core data. This also seems clean but I worry about iCloud backup - it now seems I would need to sync core data and a bunch of photos?

  3. Only store local/device URLs to photos. This seems very low touch which I like but worried that users may end up deleting or editing photos from their roll and forget it's in my app - again has issues around syncing as well.

Would love some feedback ideas, stories haha anything really :)

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Dang... Photokit is the way, how did I miss this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...