Help with probably a basic problem..

Discussion in 'iOS Development' started by poopstain, Aug 22, 2009.

  1. poopstain

    poopstain New Member

    Joined:
    Sep 8, 2008
    Messages:
    397
    Likes Received:
    0
    Device:
    iPod touch
    I've been following this tutorial here
    http://monoclestudios.com/cocos2d_whitepaper.html

    I have tried it a few times and looked over my code a lot. Every time I compile it though, it gives me the warning shown below, and when the app launches it shows a black screen and says "Application GameDemo has quit unexpectedly"

    Please Register or Log in to view images



    I downloaded the finished tutorial from the site and it compiles just fine.. And I've looked back and forth between code and they are all the same except for the app name of course.

    Is there a common cause for this or do I need to post more details?
  2. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Try this, instead of:
    [objc]UIWindow *window = [[UIWindow alloc] initWithFrame:blahBlah][/objc]

    put this:
    [objc]window = [[UIWindow alloc] initWithFrame:BlahBlah][/objc]

    I think that you already declared window.
  3. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    UIWindow *window is already declared in the header. Drop the "UIWindow *" in the first line of the "applicationDidFinishLaunching:" block.

    Edit: Pelaez got me.

    Please Register or Log in to view images

  4. poopstain

    poopstain New Member

    Joined:
    Sep 8, 2008
    Messages:
    397
    Likes Received:
    0
    Device:
    iPod touch
    I just now tried that, and I'm still getting 3 warnings. The first is the setlandscape warning from the last time, and two warnings at the bottom say that the method '-window' needs to be defined.

    When I compile it, I still get the "Application GameDemo has quit unexpectedly" error.

    All of the code is exactly the same as the sample project, which compiles just fine.

    Please Register or Log in to view images




    edit: nevermind about the three warnings. All I'm getting now is the setlandscape warning, and the "Application has quit unexpectedly" error.
  5. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    [OBJC]
    // this is deprecated in cocos2d v 0.8+:
    [[Director sharedDirector] setLandscape: YES];

    // use this instead:
    [[Director sharedDirector] setDeviceOrientation: CCDeviceOrientationLandscapeLeft];
    [[Director sharedDirector] setDeviceOrientation: CCDeviceOrientationPortrait];

    ccDeviceOrientation = [[Director sharedDirector] deviceOrientation];

    /*
    P.S. - always check the release notes for new versions, so you don't run into any surprises.
    */


    [/OBJC]
  6. poopstain

    poopstain New Member

    Joined:
    Sep 8, 2008
    Messages:
    397
    Likes Received:
    0
    Device:
    iPod touch
    That did the trick. Thank you guys for the great help and quick responses!
  7. ipodmail09

    ipodmail09 Member

    Joined:
    Mar 13, 2009
    Messages:
    269
    Likes Received:
    0
    Device:
    2G iPod touch
    what is the game about ?
  8. poopstain

    poopstain New Member

    Joined:
    Sep 8, 2008
    Messages:
    397
    Likes Received:
    0
    Device:
    iPod touch
    ? I haven't started it yet. That was just a little hello world app. I'm still trying to figure out Cocos2d. It's getting a lot easier though.

    Please Register or Log in to view images



    In the end it will be a tower defense game with a pretty big twist.. But first I have to do a couple more tutorials before I get too ambitious.

    Please Register or Log in to view images

Share This Page