N00b - Question About Putting Code together Bit by Bit

Discussion in 'iOS Programming' started by andreab35, Jan 1, 2009.

  1. andreab35 macrumors 6502a


    May 29, 2008
    Hey guys!

    Ok, I've been reading a bit and I'm kind of getting the hang of iPhone development. I've downloaded some sample codes to play around with so I can understand the feel of the interface and all other things.

    I have a couple of questions:

    When I download a sample app for XCode, I am not able to "build and run" it. The "build and run" button is disabled. Do you know why?

    When I download a sample app's coding, I open it, and then open a new project for myself. I analyze the sample code's app, and then look at my almost blank canvas project. So, I start out with either appname.h or appname.m and start typing in the code from the sample app to my blank canvas. Say in the appname.m, I type out one line in that sample app onto my blank project. I build and run it, and it works fine.
    Then, when I do a second line from the sample app and type exactly into mine, I get errors and warnings.
    So my question is, is it ok if you get warnings and "failed's" since the whole application hasn't been put together yet?

    And one more thing: what do all of the colors that are typed up mean? I know green is for comments, like the //This comment or /*This comment*/ Brown is for the imports like #import: "AppSample.h"
    But I don't know what the blue, the purples, and black colors mean.

    I really appreciate all the help. I am hoping to learn a bit more on my journey.
    I apologize if I'll be annoying... I will be probably post here if I am absolutely stumped. Thanks! :eek:
  2. newb16 macrumors regular

    Feb 27, 2008
    I don't like to guess, but may be it need to lauch iphone simulator and it's not configured yet?

    C programs are not guaranteed to work if copied partially. Ability to read and understand error messages matters even more.

    Neiter do I. Reserved words, numbers, strings maybe?
  3. caveman_uk Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    Maybe the sample code links to frameworks you haven't included in your project?
  4. psingh01 macrumors 65816

    Apr 19, 2004
    Just another guess...maybe the code is inside one of those virtual disks that pop up on the desktop and Xcode thinks it's read only. So copy the code to a regular folder and maybe it will work.

    Colors don't mean anything. You can set them up however you wish in the preferences. This just happens to be how Xcode has them. If you used Visual Studio on windows it would have different colors. Just look at the preferences and you'll see what your colors are for.

Share This Page