XCode/Interface Builder connections bug
I just found a bug in XCode and Interface builder. (It was the reason for my problem in the thread I posted yesterday) It goes as follows: if you have an IBOutlet object of some name, and a set method using the same name, the IBOutlet object will become nil. I created a test project which you can download here. In it, I have an NSTextField test object (which I connect to testString), and I also have a setTestString method. I test to see if testString is nil, and output (in another NSTextField) whether it's nil or not. If you run it as-is, with the set method in, it's nil. If you comment out the set method, it's no longer nil. It's a good idea to keep this in mind if this happens to you, since I spent basically an entire day before I figured out something with the name was wrong. (I also experienced it a few times today, which then led me to the exact cause)
And yes, I already sent a bug report to Apple.
And yes, I already sent a bug report to Apple.
Are you sure that that's a bug? Official Apple documentation states that they will try to set the value for an outlet first with a set method, then directly. So if the outlet is called testString and you have a method called setTestString, IB will try to connect that outlet not by setting testString directly, but by calling setTestString.
I was wondering if that was the case, but I personally think that it should always directly set it. I don't know if other people rely on the set methods for connections, but I personally don't see any need for it. It's merely caused me trouble so far.
Some ideas as to why it may be useful:
http://www.cocoadev.com/index.pl?KeyValueCoding
Official Apple docs:
http://developer.apple.com/documentation...index.html
http://www.cocoadev.com/index.pl?KeyValueCoding
Official Apple docs:
http://developer.apple.com/documentation...index.html
I use key codes. But not for IBOutlets that are connected through Interface Builder. 
Edit: and IBOutlet connections were around long before key-codes were introduced in Panther, so it's not like they must rely on the key codes.

Edit: and IBOutlet connections were around long before key-codes were introduced in Panther, so it's not like they must rely on the key codes.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Interface Builder Tutorials | Talyn | 1 | 2,205 |
Sep 29, 2008 08:56 PM Last Post: Terrydil |
|
| Interface Builder bindings | _Bison_ | 4 | 2,945 |
Jan 11, 2008 01:11 PM Last Post: SethWillits |
|
| Interface Builder won't launch | Jake | 2 | 2,449 |
Sep 22, 2006 03:42 PM Last Post: Jake |
|
| Information on how to structure networking for gaming - Not how to code connections | lfrog | 5 | 6,538 |
Nov 28, 2005 05:29 PM Last Post: Skorche |
|
| Dumb Xcode interface question... | WhatMeWorry | 1 | 2,608 |
Oct 17, 2005 02:24 PM Last Post: Taxxodium |
|

