Amazon.com Widgets 19.7 will not decode
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 21, 2014, 09:12:31 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 19 - Archiving
| | | |-+ 19.7 will not decode
Pages: [1] Go Down
Print
Author Topic: 19.7 will not decode (Read 1170 times)
j_rok
Newbie
*
Posts: 2


Email




on: June 30, 2011, 12:41:33 PM

When I try to run 19.7  this is what I get

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -
[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (AddressBook)'

it gets stuck at this line:

    myBook = [NSKeyedUnarchiver unarchiveObjectWithFile: @"addrbook.arch"];

and tells me    thread 1: Program received signal: SIGABRT

There are no warnings of issues displayed to point me where I went wrong.

I have looked at the Appendix B  Address Book Source Code section at the back of the book to see where I went wrong but the addressbook and addresscard interface and implementation files don't really match up, unless I just looked at them wrong.
I'm stumped.
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #1 on: June 30, 2011, 01:17:11 PM

Make sure your AddressBook and AddressCard classes both have initWithCoder: and encodeWithCoder: methods defined in them.  Also, make sure they're spelled correctly.  If you can't find the problem, zip your code and post it and I'll have a look.

Cheers,

Steve
Logged
j_rok
Newbie
*
Posts: 2


Email




Reply #2 on: July 05, 2011, 07:51:58 AM

where do I look to find the files I've  archived
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #3 on: July 05, 2011, 12:22:44 PM

Look at XCode > Preferences > Locations for the folder that XCode uses by default.   You'll have hunt down the folder that contains the app that XCode builds.  Better is to either specify a path your own in that preference pane or to use an absolute path in your file name; e.g.

Code: (Objective-C)
myBook = [NSKeyedUnarchiver unarchiveObjectWithFile: @"/Users/steve/progs/addrbook.arch"]

Cheers,

Steve
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.