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

Newbie question


  • Subject: Newbie question
  • From: "john darnell" <email@hidden>
  • Date: Mon, 7 Apr 2008 11:45:18 -0500
  • Thread-topic: Newbie question

Hello all:

For those of you who do not like answering elementary questions, you
might want to give this message a pass.

I am making my first foray into writing Cocoa applications, and I have
created a very simple class.  The header file looks like this:

   /* Chooser */

   #import <Cocoa/Cocoa.h>

   @interface Chooser : NSObject
   {
   }

   - (NSString) *ChooseString:(int) IntVal;  //  If I comment out this
line, the error and first warning goes away
   @end


And the implementation file looks like this:


   @implementation Chooser
   /*  Commented out for debugging purposes
   - (NSString) *ChooseString:(int) IntVal;
   {
   }
   */
   - (id) init
   {
      self = [super init];
      if (self != nil)
      {
         NSString * ListOfStrings = @"A stitch in time saves nine/No use
crying over spilt milk/A bird in the hand is worth two in the bush/Never
put of to tomorrow what can be done today/Do not judge a man until you
have walked a mile in his shoes";
         NSArray *StringList = [ListOfStrings
componentsSeparatedByString:@"/"];

      }
      return self;
   }

   @end

I am getting the following error/warning messages:

   error: parse error before '*' token
   warning: '@end' must appear in an @implementation context
   warning: unused variable 'StringList'

I am using "Learning Cocoa with Objective-C, 2nd Edition" as my
tutorial.  Looking at the examples provided by the author does not help
me figure out what I am doing wrong.  It is probably something very
simple, but being new to the language, I cannot yet see it.  I have two
questions:

1.)  If this is not the best place to ask such learning questions, can
you please point me to a better forum/mailing list?

2.)  Can anyone see what I am doing wrong?

TIA!

R,
John A.M. Darnell
Team Leader
Walsworth Publishing Company
Brookfield, MO
John may also be reached at email@hidden

Trivia Question:  In SciFi Channel's hit series, FARSCAPE, who played
the voice of Pilot?


_______________________________________________

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: Newbie question
      • From: Johannes Huning <email@hidden>
    • Re: Newbie question
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Newbie question
      • From: Michael Vannorsdel <email@hidden>
  • Prev by Date: Open-source NSToolbar?
  • Next by Date: Re: Open-source NSToolbar?
  • Previous by thread: Re: Open-source NSToolbar?
  • Next by thread: Re: Newbie question
  • Index(es):
    • Date
    • Thread