PDA

View Full Version : N00b - Question About Putting Code together Bit by Bit




andreab35
Jan 1, 2009, 07:38 AM
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! :o



newb16
Jan 2, 2009, 07:30 AM
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?

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


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.

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


But I don't know what the blue, the purples, and black colors mean.

Neiter do I. Reserved words, numbers, strings maybe?

caveman_uk
Jan 3, 2009, 04:25 PM
Hey guys!
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?

Maybe the sample code links to frameworks you haven't included in your project?

psingh01
Jan 4, 2009, 09:39 AM
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.