{"id":22946,"date":"2018-10-01T17:17:56","date_gmt":"2018-10-01T21:17:56","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=22946"},"modified":"2018-10-05T14:30:15","modified_gmt":"2018-10-05T18:30:15","slug":"ios-12-and-core-data-external-binary-data-storage","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/10\/01\/ios-12-and-core-data-external-binary-data-storage\/","title":{"rendered":"iOS 12 and Core Data External Binary Data Storage"},"content":{"rendered":"<p><a href=\"http:\/\/openradar.appspot.com\/44884416\">rodhan<\/a>:<\/p>\n<blockquote cite=\"http:\/\/openradar.appspot.com\/44884416\">\n<p>On iOS 12, binary data stored in Core Data with the External Storage option gets corrupted\/goes missing on every second save of the context.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/52586564\/ios-12-specific-problem-core-data-external-storage-binary-data-corruption\">Others<\/a> <a href=\"https:\/\/forums.developer.apple.com\/thread\/109189\">seem<\/a> to be encountering the same issue. <a href=\"https:\/\/developer.apple.com\/documentation\/coredata\/nsattributedescription\/1498295-allowsexternalbinarydatastorage\">External storage<\/a> is so convenient, but it seems to be a continual source of problems and bugs.<\/p>\n\n<p>Previously: <a href=\"https:\/\/mjtsai.com\/blog\/2014\/07\/31\/core-data-external-binary-data-storage-and-migration\/\">Core Data, External Binary Data Storage, and Migration<\/a>.<\/p>\n\n<p id=\"ios-12-and-core-data-external-binary-data-storage-update-2018-10-02\">Update (2018-10-02): See also: <a href=\"https:\/\/news.ycombinator.com\/item?id=18119013\">Hacker News<\/a>.<\/p>\n\n<p id=\"ios-12-and-core-data-external-binary-data-storage-update-2018-10-04\">Update (2018-10-04): See also: some <a href=\"https:\/\/twitter.com\/mjtsai\/status\/1046874238655836161\">Twitter discussion<\/a>.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/McCloudStrife\/status\/1047687510682349569\">McCloud<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/McCloudStrife\/status\/1047687510682349569\">\n<p>Language bindings are a minor issue - here&rsquo;s my POV: I have to ship a reliable product. With data loss like external stores disappearing I&rsquo;m SOL, and it&rsquo;s in a codebase that I cannot fix or guarantee a fix to. Sure, my SQLite model will be slower, but <em>correct<\/em><\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/McCloudStrife\/status\/1047687932549591040\">McCloud<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/McCloudStrife\/status\/1047687932549591040\">\n<p>I can live with slower, even an order of magnitude so, over data loss. The business costs are huge for the latter. Even the emotional costs, what if I lose someone&rsquo;s pictures of a deceased loved one? There&rsquo;s a human on the receiving end of my program most of the time...<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/drewmccormack\/status\/1047831991587131392\">Drew McCormack<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/drewmccormack\/status\/1047831991587131392\">\n<p>Ouch! Just got bitten by a serious Core Data bug in macOS 10.14 and iOS 12 with external binary storage. Firefighting all day to save my user&rsquo;s data.<\/p>\n<p>It&rsquo;s in an old app (Studies). Created the model about 10 years ago. I&rsquo;ve learnt my lesson with external binaries.<\/p>\n<\/blockquote>\n\n<p>Ensembles is <a href=\"https:\/\/twitter.com\/drewmccormack\/status\/1047837167282794496\">not affected<\/a>.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/iljawascoding\/status\/1047846674398412801\">Ilja A. Iwas<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/iljawascoding\/status\/1047846674398412801\">\n<p>There are days when I wonder if it was worth coming up with our homegrown CoreData replacement. And then there are days like today.<\/p>\n<\/blockquote>\n\n<p>The Omni Group wrote <a href=\"https:\/\/github.com\/omnigroup\/OmniGroup\/tree\/master\/Frameworks\/OmniDataObjects\">OmniDataObjects<\/a> because Core Data was originally not available on iOS, and OmniFocus continues to use it.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/iljawascoding\/status\/1047849510725193728\">Ilja A. Iwas<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/iljawascoding\/status\/1047849510725193728\">\n<p>If Apple doesn&rsquo;t allocate enough resources for screening incoming bug reports during their beta phase, sticking to a yearly macOS release schedule is not responsible to users and developers. Small indy devs probably don&rsquo;t recover from such hits.<\/p>\n<\/blockquote>\n\n<p>It <a href=\"https:\/\/forums.developer.apple.com\/thread\/87048\">looks<\/a> <a href=\"https:\/\/stackoverflow.com\/questions\/46225247\/nsbatchdeleterequest-does-not-delete-external-files\">like<\/a> <code>NSBatchDeleteRequest<\/code> also doesn&rsquo;t work with external binary data.<\/p>\n\n<p id=\"ios-12-and-core-data-external-binary-data-storage-update-2018-10-05\">Update (2018-10-05): <a href=\"https:\/\/twitter.com\/colincornaby\/status\/1047955890198872064\">Colin Cornaby<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/colincornaby\/status\/1047955890198872064\"><p>So we&rsquo;ve done our best to try and repro the iOS 12\/Core Data External Binary Storage bug in our apps&#8230; and we can&rsquo;t.<\/p><p>I&rsquo;m not saying the bug doesn&rsquo;t exist. I know it does. I just don&rsquo;t know why we can&rsquo;t repro it in our apps, and it&rsquo;s driving me crazy.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>rodhan: On iOS 12, binary data stored in Core Data with the External Storage option gets corrupted\/goes missing on every second save of the context. Others seem to be encountering the same issue. External storage is so convenient, but it seems to be a continual source of problems and bugs. Previously: Core Data, External Binary [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-10-01T21:17:58Z","apple_news_api_id":"38c732d5-c4da-4c50-a9e0-014edf29638b","apple_news_api_modified_at":"2018-10-05T18:30:20Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAABQ==","apple_news_api_share_url":"https:\/\/apple.news\/AOMcy1cTaTFCp4AFO3yljiw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[131,109,31,1610,30,1609,71,1227],"class_list":["post-22946","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-coredata","tag-ios","tag-ios-12","tag-mac","tag-macos-10-14","tag-programming","tag-top-posts"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=22946"}],"version-history":[{"count":5,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22946\/revisions"}],"predecessor-version":[{"id":22998,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22946\/revisions\/22998"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=22946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=22946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=22946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}