• 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
objectAtIndex quandry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

objectAtIndex quandry


  • Subject: objectAtIndex quandry
  • From: James Stroud <email@hidden>
  • Date: Sat, 22 May 2004 02:58:31 -0600

Here is a clarification for the skeptics. I made a class (properly hooked up to the NIB, I assure you). The files ("AppController") are below. Started fresh with a new "Cocoa Application". Now I get the more meaningful but equally frustrating error:

2004-05-22 02:46:53.706 Test[670] *** -[NSCFNumber objectAtIndex:]: selector not recognized

My NSArray has turned into an NSCFNumber while I was waiting around. This looks like a pointer issue. What don't I know about cocoa?

--

// AppController.h

#import <Foundation/Foundation.h>

@interface AppController : NSObject {
IBOutlet id theStringDisplay ;
IBOutlet id theElementDisplay ;
NSString *theString ;
NSArray *theArray ;
}

- (IBAction)updateTheStringDisplay:(id)sender ; // called first with a button to get going
- (IBAction)updateTheElementDisplay:(id)sender ; // called immediately after

@end

// End of AppController.h


// AppController.m

#import "AppController.h"

@implementation AppController

- (IBAction)updateTheStringDisplay:(id)sender
{
theString = @"bob carol ted alice fred wilma barney betty bambam" ;
theArray = [theString componentsSeparatedByString:@" "] ;
[theStringDisplay setString:theString] ;
[theElementDisplay setStringValue:[theArray objectAtIndex:0]] ;
}

- (IBAction)updateTheElementDisplay:(id)sender
{
[theElementDisplay setStringValue:[theArray objectAtIndex:3]] ;
}

@end



---------------------------------------------------------
James Stroud
Department of Chemistry
University of Colorado
Boulder, CO 80309-0215, USA

tel: 303-492-4503
www: http://JamesStroud.com/
--------------------------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: objectAtIndex quandry
      • From: "Louis C. Sacha" <email@hidden>
    • Re: objectAtIndex quandry
      • From: j o a r <email@hidden>
  • Prev by Date: RE: Avoiding == and = mixup in if statements
  • Next by Date: objectAtIndex quandry
  • Previous by thread: Re: NSTask problems with the path - The Code
  • Next by thread: Re: objectAtIndex quandry
  • Index(es):
    • Date
    • Thread