Instance Variable Not Always Recognized

11 views
Skip to first unread message

Keary Suska

unread,
Oct 8, 2016, 11:25:22 AM10/8/16
to objec...@googlegroups.com
I have just run across a strange error in the real-time compiler. I have a class with an instance variable “coursePopupButton” declared:

@outlet CPPopUpButton coursePopupButton;

But here:

- (void)windowDidLoad
{
[super windowDidLoad];

// set popup
var courseList = [[[_delegate profileResource] trainerCourses] sortedArrayUsingDescriptors:[CPArray arrayWithObject:[CPSortDescriptor sortDescriptorWithKey:"courseName" ascending:YES]]];
[coursePopUpButton removeAllItems];
for (var i=0; i<[courseList count]; i++)
{
var row = [courseList objectAtIndex:i];
var item = [[CPMenuItem alloc] initWithTitle:[row name] action:nil keyEquivalent:nil];
[item setTag:[row trainerCourseID]];
[item setRepresentedObject:row];
[coursePopUpButton addItem:item];
}

I get the error:

WARNING line 63 in http://localhost:8888/CERTS/LMSCourseReportWindowController.j: Using unknown class or uninitialized global variable ‘coursePopUpButton'

on both occurrences of coursePopUpButton.

But I don’t get it anywhere else, and there are three more uses of the ivar in that file. Sure enough, the compiled versions show:

(coursePopUpButton == null ? null : coursePopUpButton.isa.objj_msgSend0(coursePopUpButton, "removeAllItems"));
and
(coursePopUpButton == null ? null : coursePopUpButton.isa.objj_msgSend1(coursePopUpButton, "addItem:", item));

But in other occurrences:

((___r1 = self.coursePopupButton), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "selectItemWithTag:", (dataModel == null ? null : dataModel.isa.objj_msgSend0(dataModel, "trainerCourseID"))));

and
var course = ((___r1 = ((___r2 = self.coursePopupButton), ___r2 == null ? null : ___r2.isa.objj_msgSend0(___r2, "selectedItem"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "representedObject"));

Any reason for this?

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

Andrew Hankinson

unread,
Oct 8, 2016, 11:40:25 AM10/8/16
to objec...@googlegroups.com
coursePopupButton
coursePopUpButton

:)


--
You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectivej+...@googlegroups.com.
To post to this group, send email to objec...@googlegroups.com.
Visit this group at https://groups.google.com/group/objectivej.
For more options, visit https://groups.google.com/d/optout.

Keary Suska

unread,
Oct 8, 2016, 11:44:59 AM10/8/16
to objec...@googlegroups.com

> On Oct 8, 2016, at 9:40 AM, Andrew Hankinson <andrew.h...@gmail.com> wrote:
>
> coursePopupButton
> coursePopUpButton
>
> :)

Doh! Seemed to odd to be true. I solved it by renaming it, which of course would have fixed the typo.

Sorry for the noise!
Reply all
Reply to author
Forward
0 new messages