Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How do I log data from an app running on the iPad to the console in XCode? — Gideros Forum

How do I log data from an app running on the iPad to the console in XCode?

roberthahnroberthahn Member
edited December 2011 in General questions
I'd like to verify the way my app is working correctly by logging debug data.

What I usually do is build and deploy an app to the iPad. When it's deployed, XCode leaves a console window open. For the most part I see messages like this:

fps: 60.0324

Which obviously shows that something is logging data.

Is there a log or debug object that writes strings to this console?
Tagged:

Comments

  • atilimatilim Maintainer
    Hi,

    You usually use print(...) function to write your messages to the output window of Gideros Studio. (this is the preferred and easy way)

    On the other hand, any data directed to stdout and stderr is written to the Xcode's console. Therefore, if you want, you can use io.write(...) (default output file is stdout) to display your messages at Xcode's console.
  • I tried print() but that would only work from the player - which is fine, but doesn' t handle multitouch. That's why I got in the habit of testing on the iPad.

    Thankfully the Export->Switch to XCode->Build process is pretty quick for me.
  • atilimatilim Maintainer
    edited December 2011
    Hi,

    Btw, did you install Gideros Player on your iPad? (there is a file GiderosiPadPlayer.zip comes with the installation). Without it, developing a multitouch application can be really discouraging.
  • um, no! I didn't know that there was such a thing :) I'll add it next time I'm working on my project.
  • gorkemgorkem Maintainer
    @roberthahn you should try it :) It's a 1-second "run-your-app-on-a-real-device", which is really time saving :) I believe you'll love it.

    Likes: atilim

    +1 -1 (+1 / -0 )Share on Facebook
  • And with the player app, you can use a simple "print" statement for messages which then show up in the Studio Output text box.

    Likes: atilim

    +1 -1 (+1 / -0 )Share on Facebook
  • Oh and change your code, check its working, change more check its working... ON the device.
    No wait for build, open itunes copy file across and then find its just failed. ;)
    Its just the way I imagined it should be. No more imagining. :)

    Mike

    Likes: atilim, gorkem

    What would you do for your other half?

    http://www.sharksoupstudios.com
    +1 -1 (+2 / -0 )Share on Facebook
  • quick followup: found the zip file, built the iPad player and deployed it. Yeah, that's really nice! :) time to add print() statements!
  • Hi,

    You usually use print(...) function to write your messages to the output window of Gideros Studio. (this is the preferred and easy way)

    On the other hand, any data directed to stdout and stderr is written to the Xcode's console. Therefore, if you want, you can use io.write(...) (default output file is stdout) to display your messages at Xcode's console.
    Could you provide details about how to write to xCode/Eclipse's console?
    I am using third party libraries in my app that are only linked in eclipse and xcode project's and I need the ability to log info in order to debug my program.

    Alternatively is there a way to differentiate an app running on gideros player on a real device from an app running on its own on real device?
    Once again, I would still like to use Gideros player for things that do not require third party libraries.

    Thanks.
  • ar2rsawseenar2rsawseen Maintainer
    from lua docs, io.write writes right to the stdout, thus you can simply do:
    io.write("write stuff")
    And currently I think there is no way to distinguish between player and real app.
    But you can easily swith your app to player (which will have preinstalled plugins that your app project have)

    http://docs.giderosmobile.com/deployment.html
    check Device player with plugins
  • @ar2rsawseen

    Wow... you just saved me a ton of time! Device player with plugins is the greatest thing since sliced bread!

    I'm near the end of my first self published project and a slew of Gamekit testing is headed my way. This is is life saver!

    For those of you who don't know, simply turning on the gdr_initialize switch in your Xcode project allows you to use the Gideros player within your app environment.

    Truly a Genius feature, big thanks to the Gideros team for this one!
  • @ar2rsawseen
    Thanks for the link about player with Plugins, it makes perfect sense!

    As for the the io.write("Some Stuff"), I cannot make it work.
    When I put it in my Gideros code, I don't see anything in my XCode console, while running the exported project, maybe Xcode does some kind of message filtering to show only log relative to current app, but I don't know how to "tag" my message to make it look like one coming from my app.

    I also tried using io.output:write("Stuff") but does not work...
    I will try to use print() on a real device running gideros player with the appropriate plugins to see I can make it work.
  • @Isouchet

    I gave up on the io.write once I found out about the custom player. I could never get any output to the Xcode console.

    Likes: ar2rsawseen

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.