• 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
Re: "Controller Cannot Be nil" on binding NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Controller Cannot Be nil" on binding NSTextField


  • Subject: Re: "Controller Cannot Be nil" on binding NSTextField
  • From: Johnny Lundy <email@hidden>
  • Date: Tue, 13 May 2008 00:06:11 -0400

Yeah, a stupid mistake. Thanks for noticing that. I had that as awakeFromNib and changed it but forgot to give it a nonvoid return value. Since the error was about a controller, and only happened when I bound an IB textField, and the app ran perfectly to the console, it never occurred to me that there could be a problem in the code.

I've read the docs dozens of times in the past six years, attended four WWDCs, had Select developer for many years, have both editions of Aaron's book, Beam and Davidson's book, and two O'Reilly Cocoa books, and watched all the WWDC session videos. Been programming since 1965. This is the hardest stuff I ever saw. And the Apple docs are very thin on details. If I could just know exactly what something actually does, I could grok it - but the docs are very vague and superficial.

Should this code be in awakeFromNib? Does it matter?

It works now, but I still have to do the crazy

self.hoursString = [[NSNumber numberWithInt: self.hours] stringValue];

To get a string from an int for the textField to bind to. If I bind it to the model deadline.hours, which is a scalar int, it displays zero while NSLog is merrily displaying 23 from the same variable.

Is converting the int to a NSNumber and then to a string make sense here? Seems roundabout.

Thanks again.

On May 12, 2008, at 11:17 PM, email@hidden wrote:

Message: 12
Date: Mon, 12 May 2008 20:28:06 -0600
From: Keary Suska <email@hidden>
Subject: Re: "Controller Cannot Be nil" on binding NSTextField
To: "Cocoa-Dev (Apple)" <email@hidden>
Message-ID: <C44E58D6.229F7%email@hidden>
Content-Type: text/plain;	charset="US-ASCII"

on 5/12/08 7:01 PM, email@hidden purportedly said:

- (void) init
{
deadlineTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector:@selector(updateTime:) userInfo:nil repeats:YES];
self.deadlineHours = 24;
self.startTime = [NSCalendarDate calendarDate]; //Current date
self.endTime = [startTime dateByAddingYears:0 months:0 days:0
hours:self.deadlineHours minutes:0 seconds:0];
}

Init does not return void, it returns id. The init method is entirely wrong,
and this is a very fundamental issue. You need to re-read the Objective-C
guide and make sure you understand how to instantiate objects before you go
any further.


Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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: "Controller Cannot Be nil" on binding NSTextField
      • From: Graham Cox <email@hidden>
    • Re: "Controller Cannot Be nil" on binding NSTextField
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: list open application windows
  • Next by Date: Re: list open application windows
  • Previous by thread: Re: "Controller Cannot Be nil" on binding NSTextField
  • Next by thread: Re: "Controller Cannot Be nil" on binding NSTextField
  • Index(es):
    • Date
    • Thread