Re: Grief with porting IB palettes to plugins
Re: Grief with porting IB palettes to plugins
- Subject: Re: Grief with porting IB palettes to plugins
- From: Ricky Sharp <email@hidden>
- Date: Thu, 1 Nov 2007 18:30:26 -0500
On Nov 1, 2007, at 6:16 PM, Michael B. Johnson wrote:
sounds like some sort of conflict between IB expecting keyed coding
and you not giving it (or vice versa).
Does your custom archiving supported keyed coding? Does it detect
it in the archiver?
i.e. I have code like:
if ([decoder allowsKeyedCoding]) {
NSKeyedUnarchiver* coder = (NSKeyedUnarchiver*)decoder;
if ([decoder containsValueForKey:FOLSheet__width] && [decoder
containsValueForKey:FOLSheet__height]) {
CGFloat width = [coder decodeDoubleForKey:FOLSheet__width];
CGFloat height = [coder decodeDoubleForKey:FOLSheet__height];
[self setSize:NSMakeSize(width, height)];
}
} else {
NSLog(@"FOLSheet only supports keyed decoding!");
}
All my implementation of NSCoding always uses the keyed APIs. I added
some extra logging to ClockControl and verified it too does keyed
archiving:
11/1/07 6:22:19 PM Interface Builder[6668] ClockControl
encodeWithCoder: BEGIN
11/1/07 6:22:19 PM Interface Builder[6668] ClockControl keyed coding
used
11/1/07 6:22:19 PM Interface Builder[6668] ClockControl
encodeWithCoder: END
11/1/07 6:22:19 PM IBCocoaSimulator[6674] An uncaught exception was
raised
11/1/07 6:22:19 PM IBCocoaSimulator[6674] *** -[NSKeyedUnarchiver
decodeObjectForKey:]: cannot decode object of class (ClockControl)
11/1/07 6:22:19 PM IBCocoaSimulator[6674] *** Terminating app due to
uncaught exception 'NSInvalidUnarchiveOperationException', reason:
'*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of
class (ClockControl)'
Now then, I did add logging to ClockControl's initWithCoder:, but I
get get any output from that. It's almost as if the simulator has an
object (ClockControl in this case) and is attempting to invoke
initWithCoder but cannot? It should be able to find the method as the
object does conform to NSCoding.
There has to be some other "magic" that is being omitted by both
myself and Apple's sample. I've verified though that
the .classdescription file contains all that is required. The docs on
building a palette basically have you configure a few things and then
install the plugin. I've now triple-checked the instructions and just
cannot see anything that I missed.
And, as mentioned initially, I even commented out the entire guts of
my NSCoder API implementations. I simply called super and did no
extra work (to rule out any possibility that the coder/decode was
failing on any of my custom ivar lines).
--
Rick Sharp
Instant Interactive(tm)
On Nov 1, 2007, at 3:51 PM, Ricky Sharp wrote:
I unfortunately assumed that porting my IB palettes would be fairly
straightforward. I just cannot get anything to work in IB's
simulator.
All my plugins suffer the same fate as the ClockControlPalette
sample. I can drag items from the library over to say a window.
Running will always crash the simulator and in the console I get
the same report:
2007-11-01 17:44:45.457 IBCocoaSimulator[6464:10b] An uncaught
exception was raised
2007-11-01 17:44:45.458 IBCocoaSimulator[6464:10b] *** -
[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of
class (ClockControl)
11/1/07 5:44:45 PM IBCocoaSimulator[6464] *** Terminating app due
to uncaught exception 'NSInvalidUnarchiveOperationException',
reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot
decode object of class (ClockControl)'
Or, in my own palettes, I see <my_object_name> instead of
ClockControl. All my custom objects conform to NSCoding. I even
had my implementations only do a call to super.
I even removed all ivars from a custom view and simply just had a
drawRect: with...
[[NSColor blackColor] set];
NSRectFill ([self bounds]);
What gives? Has anyone been able to get ClockControl to work. Or,
more importantly, their own IB plugins to work in the simulator?
Finally, it appears that ClockControl is the only sample code for
the new ibplugin architecture? If so, that's really sad.
I know that if I can ever get past this brick wall, I'm hoping to
provide a much richer example which would show:
* plain vanilla NSView subclass
* a "container" class
* a control with cell
* NSMatrix subclass
* formatter
* custom bindings
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Founder & President
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden