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

hrithik123

macrumors member
Original poster
Feb 3, 2010
97
0
// Simple program to work with fractions
#import <Foundation/Foundation.h>
int main (int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int numerator = 1;
int denominator = 3;
NSLog (@”The fraction is %i/%i”, numerator, denominator);
[pool drain];
return 0;
}

i want to run this simple out put in iphone

what can i do?
 
1) Why? It presents no UI that any user can ever see.

2) Join the developer program at http://developer.apple.com and follow the instructions to get a provisioning profile, signing certificates etc (note you need to pay $99 for this). You can put that on your own phone but Apple are never going to approve anything without a UI for the store.
 
i am very new in this

so i want to know when i build application then how its looks in iphone so for now i just want to see how can i see out put on IPHONE
 
so i want to know when i build application then how its looks in iphone so for now i just want to see how can i see out put on IPHONE

I already told you: follow the link, sign up to the program. I can already tell you how that will look on the iPhone though: it won't look like anything as there is no UI. It will launch, and then immediately return to the springboard.
 
NSLog writes to the console, so to see the output you have to use the console on your computer. In XCode go to Run->Console and the output will show there when you run the program.

The iPhone does not have any built in way to display console output.
 
NSLog writes to the console, so to see the output you have to use the console on your computer. In XCode go to Run->Console and the output will show there when you run the program.

The iPhone does not have any built in way to display console output.

ok so if i build game for Iphone using objective c so i have to check Run->Console ...

for see this in Iphone i have to pay $99 then i see this in iphone?

am i right?
 
ok so if i build game for Iphone using objective c so i have to check Run->Console ...
Or you could build a User Interface so as the user can actually use the game. Both for the simulator and the iPhone.
for see this in Iphone i have to pay $99 then i see this in iphone?

am i right?

Yes, you have to pay to be able to put your code on the phone but without a real user interface (NSLog will not work) you won't see anything.

I suggest before you spend any money download the tools from developer.apple.com and run through the tutorials and samples.
 
I think I remember that example from the Steve Kochan book on learning Objective-C? Am I right?

You're quite a way off making iPhone applications, as most of that book is about theory, and uses terminal applications as appose to applications with a user interface.

I suggest finishing the book (or at least reading up to and including chapter 15), then looking at the book 'Begining iPhone 3 Development'.

The book you're reading now will give you a grasp of the syntax and some of the major features of the language...then the second book will teach you how to apply it to iPhone applications.
 
I think I remember that example from the Steve Kochan book on learning Objective-C? Am I right?

You're quite a way off making iPhone applications, as most of that book is about theory, and uses terminal applications as appose to applications with a user interface.

I suggest finishing the book (or at least reading up to and including chapter 15), then looking at the book 'Begining iPhone 3 Development'.

The book you're reading now will give you a grasp of the syntax and some of the major features of the language...then the second book will teach you how to apply it to iPhone applications.

so i complete that 2 book then i am able to make good iphone application?
 
@lukenn: Ha, my fraction example is becoming famous! :)

@hrithik123: If you are reading my book, then you are right at the beginning, and as noted, the book uses the console for output throughout most of the text to focus on the language and not on building a user interface with Interface Builder.

In Chapter 21 you'll learn how to get the output on the iPhone. At that point an iPhone fraction calculator app is developed.

Good luck and don't forget there's lots of support at the forum for the book at classroomM.com/objective-c.

Cheers,

Steve Kochan
 
Does anyone ever try to look up information on the interwebz before posting a post thats been done 100000000 times.
 
Does anyone ever try to look up information on the interwebz before posting a post thats been done 100000000 times.
I don't. But perhaps I'm an anomaly. :D

I think part of the problem is that we act as enablers by answering their questions quickly rather than taking the time to point them to the myriad of other threads on the same topic.
 
Lol I can see what you mean :p I still have so much to learn but since there are a ton of iPhone devs, there is tons of content out there that a simple Google search will give them what they need haha. Gotta love the interwebz!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.