I have an application that uses the accelerometer. Sometimes, the application will launch without the accelerometer data updating. Relaunching the app, sometimes the problem persist, sometimes it doesn't. And even weirder, sometimes I can try 10 times and everything works as expected. Is this a bug, or maybe something I am missing. Debugging, this code is never called when the accelerometer is not updated:
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration;
Any ideas?
I finally found a work around. This is a known bug. So the work around I found is to start a thread and have this thread check if the accelerometer delegate has been called, if it has, then quit the thread, if not, set the delegate again, and re-test, until the accelerometer delegate gets called. I tested this throughly and it works flawlessly. I hope this gets resolved on the next update of the iPhone OS.
I have this same problem. It happens perhaps 1/20 times with an app I made from the CrashLanding sample. After I noticed it with my app I grabbed a fresh version of Crashlanding, installed it, and finally got it to start with accelerometer failing.
I don't know how to fix it. Honestly I hate the accelerometer... at least for controlling games :-\
Also, the accelerometer has occasionally failed when I start the "accelerometer" sample project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With