Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andreab35

macrumors 6502a
Original poster
May 29, 2008
825
0
USA
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:
 

newb16

macrumors regular
Feb 27, 2008
100
0
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

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
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

macrumors 68000
Apr 19, 2004
1,590
634
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.