Debugging using printf() in Xcode Console

March 2, 2011 § 2 Comments

You can use printf() function inside .m file to indicate the app status such as application starts and ends.

In Xcode, select AppDelegate.m file, insert a line inside applicationDidFinishLaunching: method:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

}

Add the following:
printf(“%s\n”, __FUNCTION__);

Note: The __Function__ has two underscores before and after the FUNCTION.

Add the same line to applicationWillTerminate: method

- (void)applicationWillTerminate:(UIApplication *)application {

}

You should be able to see the printed output inside Xcode Console when you launch the app

[AppDelegate applicationDidFinishLaunching:]

After you exit the app by pressing the Home button on the iPhone simulator, you will see this printed output
[AppDelegate applicationWillTerminate:]

About these ads

§ 2 Responses to Debugging using printf() in Xcode Console

  • Encoms.Net says:

    “Debugging using printf() in Xcode Console
    Web Builders” was in fact a fantastic blog post and
    thus I personally was extremely glad to find the blog.
    Thanks for your effort-Nydia

  • June says:

    I simply wished to just take a couple of moments and inform you that I really liked the write-up.
    I seriously don’t believe that most people know just how much work that gets put into establishing a good web site. I’m aware this will be kind of random but
    it really bothers me occasionally. At any rate fantastic website.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Debugging using printf() in Xcode Console at Web Builders.

meta

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: