Hi Jon,

I tried compiling the project you attached but I was still getting Assertion Failures so I built the project from scratch again and it loads into IB without Assertion Failures (I think there is definitely something not setup right in the project you attached!).

O.k First off, just to check; you are adding the framework to your live app, i.e...
in Groupes & Files (in your live app!):

Browse to Frameworks and select Other Frameworks.
Right click (ctl click) and navigate to Add->Existing Frameworks.
In the open panel, browse to and select /Library/ NameOfYourFramework.framework.
Click Add.

Other Frameworks should now look something like this:

Other Frameworks/
        NameOfYourFramework.framework
        AppKit.framework
        CoreData.framework
        Foundation.framework

It Is important your live app has the framework added to it as your plugin is dependent on it and will crash if it's not there!

Sorry if you are already doing this, I thought It's better to make sure as this is quite important!

Secondly, I think the reason IB keeps opening the new document window when you try and reopen the .xib is because the encoder is failing to encode the @"TextLength" property as it is not KVC-Compliant, so the component crashes when you try to save the xib, hence it also crashes when you try to decode/open the doc.

I noticed that the component's console was spewing out errors when I tried to save or reopen an .xib the the component in it (in a live app):

009-04-05 12:32:51.436 Interface Builder[26488:10b] An exception was thrown during execution of an NSScriptCommand... 2009-04-05 12:32:51.438 Interface Builder[26488:10b] [<JTextLengthFormatterView 0xaa82730> valueForUndefinedKey:]: this class is not key value coding-compliant for the key TextLength.

I changed:
[[keyPaths objectForKey:IBAttributeKeyPaths] addObjectsFromArray: [NSArray arrayWithObjects:@"TextLength", nil]];

to:
[[keyPaths objectForKey:IBAttributeKeyPaths] addObjectsFromArray: [NSArray arrayWithObjects:@"textLength", nil]];

and this seems to have stopped the crashing when reopening the .xib.

I have the project working here and can send you a .zip if you like?

Hope this helps.

All the best,
Josh

On 5 Apr 2009, at 01:10, jmun...@his.com wrote:


Sorry for going quiet like that! I got distracted!


No problem! :)

I think that the fact IB is asking you to create a new document is a
good thing!

Actually, not in this case. The plugin seems to work fine within its project, so I decided to try and "install" it so I could use it in my other (live) project. I created a new window xib (imaginatively called "test"), put a textfield on it and saved it. Then, I added the formatter to the textfield, gave it a value of 5 and saved that. On re-open, IB then asked me what sort of resource to create - test was corrupted I suppose.

I believe that when the project builds, the compiler automatically
launches the target/s (in this case an IB Plugin Component/bundle)
which in turn loads the plugin into IB and asks for you to create a
new document (to test it out)!?

So I think so far things are looking good!


In the case of the plug-in only, yes, it seems viable. However, "live" is not the case.

However, when I compiled the project, the component crashed IB,
warning about an Assertion Failure:

Assertion Message: Two plug-ins
(com.JTAENTERPRISESLLC.JTAENTLLCTextLengthLimiter and
com.JTAENTERPRISESLLC.JTAENTLLCTextLengthLimiter) both integrate a
class description for the class JTAENTLLCTextLengthLimiterFormatter.
The primary definition for the class should only come from one plug-
in; the other plug-in should be declaring a category. Declaring a
category is accomplished by omitting the super class from
classdescription file.

I have no idea where any of this is coming from or how to fix it!


I think I fixed that in the attached zip. Not sure what I did, other than to make sure all my "names" matched up in the appropriate places (I think the error was in the Limiter.m file).

I did try replicating (more or less) the project from scratch and this
seemed to get rid of the Assertion Failure and the plugin seemed to
load o.k.

Check out the attachment!


I also tested your plugin re-deux in my "live" environment and got the same result. An xib wherein the plug-in is employed seems to get corrupted and IB then asks for a new resource to create.

Give that a shot. Put your plug-in (or mine) in some frameworks directory, add it to IBs prefs->plug-ins, and add it to a project. Create a new window.xib, add a textfield, then use the formatter. Save and close the xib. Upon re-load it should crash (IB won't crash though - just the xib is corrupted).

One thing I did notice about my plug-in is that the required framework seems to want the ibplugin file. I don't know how to revert that to the .framework file. Although, in yours, it is pointing to the .framework file and it still crashes. Also, in your plug-in I had to move the ibplugin file to the A->Resources folder for IB to load the plug-in.

Hope this  helps.

All the best,
Josh.

P.S the list keeps rejecting my emails at the mo so this probably
won't show up. `I must get this fixed tomorrow!

No worries!


<JTAENTLLCTextLengthLimiter 2.zip>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to