views:

437

answers:

1

I have a class called MainGame, which is defined like this in my .h:

@interface MainGame : Renderer <UIAccelerometerDelegate>

Then later in my .m I have this:

- (void) accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration {
    // here I would read values like accelerometer.x
    NSLog(@"accelerated!!1");
}

Am I doing it right?

Currently I'm only testing in iPhone simulator, I'm going to buy the apple $99 developer thing soon. It doesn't log "accelerated!!1", but I'm guessing that's because I'm not running it on an actual device yet?

+2  A: 

Correct. The iPhone simulator does not provide Accelerometer services.

You may find this useful: http://code.google.com/p/accelerometer-simulator/wiki/Home

There is also this, which allows you to use phone input in the simulator (warning, App Store link, also has a Lite version): http://itunes.com/app/iSimulate

Gordon Christie
Thanks.I tried downloading iSimulate Lite but it keeps saying "No computers were found with a listening iSimulate-ready application."I'm using an iPod Touch, and it's connected to my Mac, and iPhone simulator is running with an app in itWhat do I do..? D:
Johannes Jensen
You can't just run it - it needs some small changes to your XCode project to make it work.Step by step instructions are here: http://www.vimov.com/isimulate/documentation/#using
Gordon Christie
Wow, it works like a gem. I just purchased it, and it's great! Thanks a lot :D
Johannes Jensen