Skip navigation.
 
mlRe: Value transformers and app delegates
FROM : Brendan Younger
DATE : Tue Dec 21 16:33:56 2004

On Dec 21, 2004, at 9:28 AM, James Dessart wrote:

> Using information from Apple's docs on value transformers, and a
> helpful post from Scott Anguish, to someone else, from August, I
> implemented an "array has contents" value transformer. I then register
> it in applicationDidFinishLaunching.
>
> However, it seems that it doesn't get registered before the nib gets
> loaded, causing the app to bail. I've put an NSLog in both
> applicationWillFinishLaunching and applicationDidFinishLaunching, and
> neither seems to get called. I have the class instantiated and set as
> the delegate in the nib, is there perhaps an ordering problem going
> on?


That's correct.  NSApp will load your nib before
-(void)applicationDid/WillFinishLaunching is ever called.  To be
absolutely sure that your transformer is  registered, you can call
[NSValueTransformer setValueTransformer:forName:] in your main()
function, before the call to NSApplicationMain(), or you can override
+(void)initialize in your application's delegate and register it there.

Brendan Younger

Related mailsAuthorDate
mlValue transformers and app delegates James Dessart Dec 21, 16:28
mlRe: Value transformers and app delegates Brendan Younger Dec 21, 16:33
mlRe: Value transformers and app delegates James Dessart Dec 21, 17:11
mlRe: Value transformers and app delegates Johan Kool Jan 16, 17:59
mlRe: Value transformers and app delegates mmalcolm crawford Jan 16, 18:55