I’m back, and didn’t get very far before getting stuck again. I cannot get this to work. I used NSCoding as described it the book, with the updated methods, and I get an assert error when I try to use File->save… Since then I’ve changed the code so many times, trying Codable, back to NSCoding and nothing works. Before I post any code, I need to go through my code to to make sure it is somewhat back to Chapter 12 code (with the updates, and of course, look for typos!). But, are there suggestions on where to look for the correct coding to archive using the save, save as…etc and Swift 4? I’ve looked through the documentation, and will continue to do so, but I haven’t found anything yet.
As a side note, I see that Swift 4.1 is out now, I haven’t updated to that one yet. Also, so you know where I’m coming from. I am trying to learn this on my own using what books I can find. I intend to use it to make apps for both Mac and IOS to supplement retirement (I’m not retired yet so I’m also working full time now). So this isn’t just a “hobby” for me and I want to learn how to use it.
Sorry this is such a long post…
Edit: I used what the book says - NSCode with the updated changes.
This was the error i was getting when trying to save:
2018-04-01 13:04:33.611245-0500 RaiseMan[26444:19140773] *** Assertion failure in -[NSVBSavePanel viewWillInvalidate:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:387
2018-04-01 13:04:33.615758-0500 RaiseMan[26444:19140773] -[NSVBSavePanel init] caught non-fatal NSInternalInconsistencyException ‘bridge absent’ with backtrace (
0 CoreFoundation 0x00007fff450d7fcb __exceptionPreprocess + 171
…
For anyone that may need it I found the solution on StackOverflow: https://stackoverflow.com/questions/47954418/using-cocoa-nssavepanel-in-swift-causes-assertion-failure