• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
initWithCoder failed in Cocoa-Java app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

initWithCoder failed in Cocoa-Java app


  • Subject: initWithCoder failed in Cocoa-Java app
  • From: Greg Kramer <email@hidden>
  • Date: Wed, 14 May 2003 13:40:44 -0400

New to Cocoa-Java programming, simply working through various learning
exercises at this point. I'm going through the BigNerdRanch book
"Cocoa Programming for Mac OSX" but converting the examples to Java.

I've run into a problem with unarchiving. Yeah, I know, this seems to
be an area that can cause lots of issues. But the specific thing I'm
seeing I haven't been able to find on the web. Here's MyDocument's
loadDataRepresentation function:

public boolean loadDataRepresentation(NSData data, String aType) {
unarchiver = new NSKeyedUnarchiver(data);
employees = (NSMutableArray) unarchiver.decodeObjectForKey("Key");
unarchiver.finishDecoding();
return true;
}

The error I get occurs right after the decodeObjectForKey line:
>old -initWithCoder: failed because ObjC result != self
>ObjCJava WARNING:
>jobjc_jvm_newObject(): constructor with signature
(Ljava/lang/String;Ljava/lang/String;)V on class MyDocument failed
(should morph the java exception)
>2003-05-14 10:53:39.174 RaiseMan[1336] (null)
>RaiseMan has exited with status 0.

I'm assuming the first line is the important one (initWithCoder
failed...) but am not sure what that is or where to track it down.
I've already tried making the unarchiver not a local variable; above,
it's already been moved up into MyDocument. The decodeObjectForKey
line *seems* to try to do something... it calls my data class and
retrieves the data from the file, but then this error appears.


If this helps, this is the constructor of my data object which uses the
coder. This is all from Chapter 6 of the book I mentioned above.
Person(NSCoder coder, long token) {
super();
setPersonName( (String) coder.decodeObjectForKey("Name") );
setExpectedRaise( new Float(coder.decodeFloatForKey("Raise")) );
}

Any thoughts or suggestions?

Thanks,
Greg K
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: piping a shell result to display it (From: Chris Ridd <email@hidden>)

  • Prev by Date: Re: piping a shell result to display it
  • Next by Date: Software Patents in Europe
  • Previous by thread: Re: piping a shell result to display it
  • Next by thread: printing an NSTextView in smaller font and different colors?
  • Index(es):
    • Date
    • Thread