{"id":1384,"date":"2017-03-07T23:17:44","date_gmt":"2017-03-08T07:17:44","guid":{"rendered":"https:\/\/www.ussherpress.com\/blog\/?p=1384"},"modified":"2023-12-09T15:03:29","modified_gmt":"2023-12-09T23:03:29","slug":"update-on-foreverlist","status":"publish","type":"post","link":"https:\/\/www.ussherpress.com\/blog\/?p=1384","title":{"rendered":"ForeverList Update: File loading and saving"},"content":{"rendered":"<p>As mentioned the other day, <a href=\"https:\/\/www.ussherpress.com\/blog\/?p=1331\">I&#8217;m working on a new app<\/a>. I&#8217;m calling it ForeverList for now. I&#8217;ll be posting updates to this blog as I make progress.<\/p>\n<p>Well, today I added file load and save!<\/p>\n<p><a href=\"https:\/\/www.ussherpress.com\/blog\/?attachment_id=1385\" rel=\"attachment wp-att-1385\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1385\" src=\"https:\/\/www.ussherpress.com\/blog\/wp-content\/uploads\/2017-03-07-Screenshot.png\" alt=\"\" width=\"1403\" height=\"896\" \/><\/a><\/p>\n<p>It took about half an hour to add. It was pretty simple to implement. All I do is serialize the tree representing the document into a JSON dictionary.* Just use <a href=\"https:\/\/developer.apple.com\/reference\/foundation\/jsonserialization\">JSONSerialization<\/a> to get this done. Easy.<\/p>\n<p>However, I then spent another half hour tracking down a bug caused by a poorly configured storyboard. (I have no idea how it got in that state.) I&#8217;d hit an exception at runtime, but other than a call stack into Cocoa, I had no way of determining what was causing the problem.<\/p>\n<p>After pulling my hair out, I decided to delete the old view controller in my storyboard and add a new one, configured exactly the same way. That fixed it. &#x1f629;<\/p>\n<p>I&#8217;m still seeing another exception in -[SFLList removeItem:], <a href=\"https:\/\/github.com\/coteditor\/CotEditor\/issues\/591\">but it looks like another Apple bug<\/a>. Argh!<\/p>\n<p>Oh yeah, at one point, Xcode crashed in the middle of typing some code. This is one thing I often forget about Mac and iOS development: a lot of time is wasted dealing with issues in Xcode or\u00a0Cocoa.<\/p>\n<p>* I should note that the JSON format here is temporary. I&#8217;m planning on saving a journal of changes <a href=\"https:\/\/www.ussherpress.com\/blog\/?p=1262\">as I did with Lil Todo<\/a>. That way I can allow multiple clients to modify the same document and sync them to a central file share, like Dropbox or OneDrive.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As mentioned the other day, I&#8217;m working on a new app. I&#8217;m calling it ForeverList for now. I&#8217;ll be posting updates to this blog as I make progress. Well, today I added file load and save! It took about half an hour to add. It was pretty simple to implement. All I do is serialize &hellip; <a href=\"https:\/\/www.ussherpress.com\/blog\/?p=1384\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">ForeverList Update: File loading and saving<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[131,120],"tags":[126],"_links":{"self":[{"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1384"}],"collection":[{"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1384"}],"version-history":[{"count":6,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions"}],"predecessor-version":[{"id":1394,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions\/1394"}],"wp:attachment":[{"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ussherpress.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}