Closed leberwurstsaft closed 11 years ago
Thanks! Should be a simple fix. Will look into this asap, probably this weekend...
I just tried to add a downloaded field to the CD model, then let it create a new .sqlite by skipping copying the comics.sqlite and reimporting the date into the new .sqlite. That certainly fixed the crash, but somehow I must be missing some detail regarding the unique primary index. My go at fixing that unique index resulted in the download stopping after 5 images ;)
Also, the downloaded
attribute will probably have to be set to yes at some point after the successful download. Just saying.
I was looking at this as well. Queries in Comic.m (request.predicate = [NSPredicate predicateWithFormat:kAttributeDownloaded @" = %@", @YES];) search using the downloaded property which doesn't exist after this commit. https://github.com/josharian/xkcd/commit/324e94daad976e986ace3c3f7e885fcdabd0c73d
Hope that makes things a little easier.
Thanks for looking into this! Here's a bit more info, in case you decide to keep looking at this.
Keeping a downloaded
attribute in the CD model ended up being a pain. (1) Restores, iCloud, etc. made it necessary to do extra work to keep it synced with the reality on the filesystem. (2) Removing it made the CD model more or less uniform across all devices, which kept updates simple. (This will change when we add starring favorites, tracking read/unread state, etc., but in the short term, it's a nice simplifier.)
Because of that, I switched to simply maintaining an NSSet of download comics in memory, which gets reloaded directly from the filesystem and gets updated as necessary. See e.g. +synchronizeDownloadedImages
in https://github.com/josharian/xkcd/blob/master/Classes/Comic.m. I simply failed to remove the old references to CD. So the fix here should be as simple as using downloadedImages
instead of CD when deleting all.
Also affects download all. (Sigh.)