{"id":11506,"date":"2015-06-18T11:49:04","date_gmt":"2015-06-18T15:49:04","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=11506"},"modified":"2015-06-18T11:50:18","modified_gmt":"2015-06-18T15:50:18","slug":"core-data-bugs","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/06\/18\/core-data-bugs\/","title":{"rendered":"Core Data Bugs"},"content":{"rendered":"<p>Almost four years ago, <a href=\"http:\/\/stackoverflow.com\/questions\/7385439\/exception-thrown-in-nsorderedset-generated-accessors\">Dev<\/a> reported a bug with Core Data&rsquo;s <code>NSOrderedSet<\/code> generated accessors (via <a href=\"https:\/\/twitter.com\/an0\/status\/608762319758323712\">Ling Wang<\/a>).<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/7385439\/exception-thrown-in-nsorderedset-generated-accessors#comment14413438_7395525\">DaGaMs<\/a>, in 2013:<\/p>\n<blockquote cite=\"http:\/\/stackoverflow.com\/questions\/7385439\/exception-thrown-in-nsorderedset-generated-accessors#comment14413438_7395525\"><p>I just brought this up with an Apple engineer during one of the CoreData Lab sessions at WWDC. They acknowledge the issue and that it&rsquo;s a genuine bug, and from what I&rsquo;ve seen it has the &ldquo;critical&rdquo; status, but of course there&rsquo;s no promise as to when they&rsquo;ll fix it. I don&rsquo;t think it&rsquo;ll be fixed in iOS6\/Mountain Lion. I think it&rsquo;d be good to duplicate this radar further. Currently it has about 25 dup&rsquo;s, the more the better!<\/p><\/blockquote>\n<p>It seems like an important and straightforward bug to fix, but it&rsquo;s still present in iOS 9.<\/p>\n<p>Another bug, reported by <a href=\"http:\/\/openradar.appspot.com\/radar?id=6111604445806592\">Michael Gorbach<\/a> (<a href=\"https:\/\/twitter.com\/mgorbach\/status\/611541698192273408\">tweet<\/a>):<\/p>\n<blockquote cite=\"http:\/\/openradar.appspot.com\/radar?id=6111604445806592\"><p>We have found a reproducible CD deadlock that can occur when using a fetched results controller with a &ldquo;complex&rdquo; (i.e. either multi-level or &ldquo;synthesized&rdquo; (not in the database) sectionNameKeyPath). This occurs specifically with a stack that has a top-level background (private queue) writing context, where the main thread context is a child of this context.<\/p><p>Changes to CD (object creations and updates) as well as fetch requests, are taking place sequentially on background &ldquo;import&rdquo; contexts (private queue contexts). These contexts are also children of the top-level private queue writing context. If, while these CD changes and fetch requests are taking place in the background, the main thread Fetched Results Controller is asked to perform it&rsquo;s initial fetch, a deadlock results.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Almost four years ago, Dev reported a bug with Core Data&rsquo;s NSOrderedSet generated accessors (via Ling Wang). DaGaMs, in 2013: I just brought this up with an Apple engineer during one of the CoreData Lab sessions at WWDC. They acknowledge the issue and that it&rsquo;s a genuine bug, and from what I&rsquo;ve seen it has [&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":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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,800,109,31,1017,904,1137,30,71],"class_list":["post-11506","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-concurrency","tag-coredata","tag-ios","tag-ios-5","tag-ios-8","tag-ios-9","tag-mac","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11506","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=11506"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11506\/revisions"}],"predecessor-version":[{"id":11508,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11506\/revisions\/11508"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=11506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=11506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=11506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}