Problem with Xcode or Problem with this string of codes?

Discussion in 'macOS' started by Xcode Beginner, May 6, 2010.

  1. Xcode Beginner macrumors newbie

    Joined:
    Apr 28, 2010
    #1
    Please see string of codes below in blue:

    Can anyone help on this? I have been going through some tutorials and just typing codes in as I am asked to do.
    However I came to a point where the code is "built and run" but I always get warning messages such as:
    " warning: 'NSArray' may not respond to '+arrayWithObjets:' "
    " warning: unused variable 'stringToOutput' "

    I am using a book titled: (Beginning Mac Programming" (Develop with Objective C and Cocoa) by Tim Isted

    Please see below. Any suggestions?

    Please note that the sad faces in the code are ":" followed by (.


    #import "NotifyingClass.h"
    #import "MathUtilities.h"
    #import "WonderfulNumber.h"

    @implementation NotifyingClass

    - (IBAction)displaySomeText:(id)sender
    {

    NSString *firstObject = @"Milk";
    NSString *secondObject = @"Eggs";
    NSString *thirdObject = @"Butter";

    NSArray *shoppingListArray = [NSArray arrayWithObjets:firstObject, secondObject, thirdObject, nil]; " warning: 'NSArray' may not respond to '+arrayWithObjets:' "
    NSString *stringToOutput = [NSString stringWithFormat:mad:"shoppingListArray = %@", shoppingListArray]; " warning: unused variable 'stringToOutput' "
    [sender setTitle:mad:"Clicked"];
    [sender setEnabled:NO];
    }

    -(float)generateValue:(float *)originalValue

    {

    float radius = [textField floatValue];
    *originalValue = radius;
    float circumference = [MathUtilities circumferenceFromRadius:radius];
    return circumference;
    }


    @end
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    There is nothing wrong with XCode. There is everything wrong with your ability to copy. It's arrayWithObjects: not arrayWithObjets:. I imagine the other issue is the same.

    Absolute accuracy is required when programming. Slow down, take more care and read the error messages. The chance of the compiler (which is not XCode by the way) being wrong and you correct are approximately 0.
     
  3. Xcode Beginner thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #3
    I am a brand brand brand new student in this and have a lot to learn. Thank you for your help. It seems that you need an eagle's eye to do programming.
    once again thank you.
     
  4. Xcode Beginner thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #4
    Do you have any suggestions for learning this think. books and any specific useful references for a beginner?
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    See the sticky threads at the top of this and the iPhone Programming forums.
     
  6. Xcode Beginner thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #6
    Thank you.
     

Share This Page