Answering my own question here, if anyone has a similar problem, make sure you 
don't mess with any outlets BEFORE your awakeFromNib method :P Yeah it's basic 
stuff but somehow I didn't noticed that a method I was calling in my 
controller's init was resetting a slider to its default position... moving that 
call to awakeFromNib appears to have fixed the issue!

Jean-Nicolas Jolivet


On 2010-03-30, at 2:31 PM, Jean-Nicolas Jolivet wrote:

> I'm having a very frustrating issue that I can't seem to be able to 
> pinpoint...
> 
> When I run my app, I randomly get a crash on startup with the following 
> message(s) in the console:
> 
> ==============================================================================================
> 2010-03-30 13:57:52.599 MyApp[6292:a0f] An uncaught exception was raised
> 2010-03-30 13:57:52.599 MyApp[6292:a0f] Controller cannot be nil
> 2010-03-30 13:57:52.601 MyApp[6292:a0f] *** Terminating app due to uncaught 
> exception 'NSInvalidArgumentException', reason: 'Controller cannot be nil'
> *** Call stack at first throw:
> (
>       0   CoreFoundation                      0x989dc40a __raiseError + 410
>       1   libobjc.A.dylib                     0x91bbe509 objc_exception_throw 
> + 56
>       2   CoreFoundation                      0x989dc138 +[NSException 
> raise:format:arguments:] + 136
>       3   CoreFoundation                      0x989dc0aa +[NSException 
> raise:format:] + 58
>       4   AppKit                              0x977e771b -[NSBinder 
> addBinding:toController:withKeyPath:valueTransformer:options:] + 252
>       5   AppKit                              0x977e00f2 
> -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 
> 703
>       6   AppKit                              0x9788c067 
> -[NSNibBindingConnector establishConnection] + 156
>       7   AppKit                              0x977bb33b -[NSIBObjectData 
> nibInstantiateWithOwner:topLevelObjects:] + 1249
>       8   AppKit                              0x977b9450 loadNib + 257
>       9   AppKit                              0x977b8848 
> +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 228
>       10  AppKit                              0x977b8759 
> +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 158
>       11  AppKit                              0x977b86a4 
> +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 383
>       12  AppKit                              0x977b54a9 NSApplicationMain + 
> 434
>       13  MyApp                               0x00002694 main + 36
>       14  MyApp                               0x00002665 start + 53
> )
> sharedlibrary apply-load-rules all
> kill
> quit
> 
> ==============================================================================================
> 
> Judging by the trace, I'm thinking it might have something to do with 
> bindings? It appears to be really random... I'd say 1 times out of 3 my app 
> starts normally, the other 2 attempts, I get this error...
> 
> Most of my controllers (that have bindings anyway) are singletons, but I 
> tried changing that (i.e. to have my sharedController method return 
> "(sharedController = [[[self class] alloc] init]);"  instead)... the bug 
> still occur...
> 
> I'm out of ideas... I guess the problem could be in my nib but I also tried 
> to perform a "diff" on my nib file (when the app actually runs and when it 
> crashes), but the nib is exactly the same in both occasions... I can post my 
> singleton code if it would help but it's a singleton template that I use all 
> the time without any problems
> 
> If anyone has a clue as to what could be happening, it would be really 
> appreciated as I really have no idea what to try next...
> 
> Jean-Nicolas Jolivet
> 

_______________________________________________

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