• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cocoa n00b frustrations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa n00b frustrations


  • Subject: Cocoa n00b frustrations
  • From: Charles Jenkins <email@hidden>
  • Date: Thu, 05 Jun 2008 09:32:18 -0400

Hi! Despite the fact that you have heard from me before on this list, I am still an newbie trying to struggle through writing my first Cocoa app.

I have experienced a couple of frustrations that I would like to share to see if anyone knows tools or practices that will help avoid them in the future.

NAUGHTY NIBS

I had a Nib file that went bad. Suddenly, my outlets doubled up: IB indicated that a class had two outlets named 'textField1' and 'textField2'.

When it came time to make connections, I had no way to tell the real ones from the ghost ones, so I changed the outlets' names in my code files and resynchronized. From that point, IB insisted that both the old and new connections existed. Worried that this might be the source of another problem I was having, I did everything I could think of to get rid of the non-existent outlets: I deleted the .h/.m and recreated them; I deleted and recreated the NSObject instance in IB; I deleted both the .h/.m pair AND the NSObject instance and recreated it all using a different class name (MyController instead of WindowController); and finally closed down IB and Xcode and edited the XIB file with TextWrangler to delete the non-existent outlet names.

Nothing worked--the new NSObject instance always magically retained the memory of textField1 and textField2--until I gave up on the Nib file by renaming my project directory and creating a new project so that I would start with a fresh Nib file. Then I moved my .h/.m files over and connected them with no problem to the new Nib.

Is there any kind of Nib repair utility that will clean up a Nib file to remove outlets, actions, and classes that do not connect up to anything in code? Having such an important file just suddenly "go bad" and have to be recreated from scratch is a real bummer.

DELEGATE DISILLUSIONMENT

You create an object (.h, .m, and object instance in IB) that a control (like a table view) will use as a delegate. Using the documentation, you cut and paste the delegate's signature to eliminate any chance that a typo will prevent it from working. In IB, you make sure that the control's 'delegate:' is connected to the object.

At runtime, the delegate never gets called.

If checking and rechecking the connection and the method's declaration and implementation doesn't help, how do you solve the problem?

Objective-C's delegation paradigm is like magic when it works, but mysterious and frustrating when there is a problem. Besides a malformed method signature and a missing IB connection, what else could be wrong?

FINALLY

Anyone know of a Cocoa user group in the Knoxville, Tennessee area?

Thanks!
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa n00b frustrations
      • From: Uli Kusterer <email@hidden>
    • Re: Cocoa n00b frustrations
      • From: "Michael Ash" <email@hidden>
    • Re: Cocoa n00b frustrations
      • From: Georg Tuparev <email@hidden>
    • Re: Cocoa n00b frustrations
      • From: Graham Cox <email@hidden>
    • Re: Cocoa n00b frustrations
      • From: Andreas Mayer <email@hidden>
    • IB label (textfield) as URL / mail-address how?
      • From: Mike <email@hidden>
  • Prev by Date: Re: App hangs when displaying any sheet in 10.5 [was Re: Where to start looking to fix hang?]
  • Next by Date: Re: How to enable crash log generation in 10.5?
  • Previous by thread: Re: CATextLayer question
  • Next by thread: IB label (textfield) as URL / mail-address how?
  • Index(es):
    • Date
    • Thread