NIB bug? Outlets = nil

  • Hi guys,

    I've had this problem on a number of occasions where outlets in a NIB
    file that are connected correctly in IB are nil when the NIB is
    loaded. What I've found in the past is that if I change the name of
    the outlet in the header file, read it back into IB and reconnect the
    outlet it works fine. If I change the name back it stops working
    again. It's as though the outlet in the NIB is corrupt or something.
    Has anybody else seen this problem?

    Cheers,
    Loukas
  • On 25 Sep 2007, at 8:39 PM, Loukas Kalenderidis wrote:

    > I've had this problem on a number of occasions where outlets in a
    > NIB file that are connected correctly in IB are nil when the NIB is
    > loaded. What I've found in the past is that if I change the name of
    > the outlet in the header file, read it back into IB and reconnect
    > the outlet it works fine. If I change the name back it stops working
    > again. It's as though the outlet in the NIB is corrupt or something.
    > Has anybody else seen this problem?

    Suppose you have an outlet named "foo."

    Do you also have a method setFoo:, that sets a property, and not the
    outlet? The NIB loader uses key-value coding, if possible, to connect
    outlets. If you have an unrelated setter method, the loader will use
    that, and won't change the instance variable directly.

    <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Pro
    tocols/NSNibAwaking_Protocol/Reference/Reference.html
    >

    — F
  • On Wed, 26 Sep 2007 11:39:24 +1000, Loukas Kalenderidis
    <loukas...> said:
    > Hi guys,
    >
    > I've had this problem on a number of occasions where outlets in a NIB
    > file that are connected correctly in IB are nil when the NIB is
    > loaded. What I've found in the past is that if I change the name of
    > the outlet in the header file, read it back into IB and reconnect the
    > outlet it works fine. If I change the name back it stops working
    > again. It's as though the outlet in the NIB is corrupt or something.
    > Has anybody else seen this problem?

    That's a FAQ, and has been answered a gazillion times, so check the
    archives. Example:

    http://www.cocoabuilder.com/archive/message/cocoa/2004/4/6/103459

    The problem is that you've got a setter (setXXX:) whose name is the same as
    the outlet (XXX). Don't Do That. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • Thanks guys.
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today