2

Please view the gist below:

https://gist.github.com/969112

Essentially, I am trying to set up a UIAccelerometerDelegate and have it receive data from a command-line iPhone application (i.e. it's jailbroken, I'm ssh'd into the phone and compiling the above code on the iPhone itself).

The above code does not work... even though the application is sitting in it's run loop, and the UIAccelerometer is active with it's delegate, no callback's are ever called...

I kind of at a loss as to what else could be needed. I was simply trying to get the most simple "hello world" example of getting at the accelerometer data was (without involving all the bloat of the UI and running a full-on app)...

So any ideas? Thanks in advance!

TooTallNate
  • 1,477
  • 3
  • 20
  • 41

1 Answers1

0

I wouldn't be surprised if a UIApplication instance was required for the accelerometer to work.

Ivan Vučica
  • 9,529
  • 9
  • 60
  • 111
  • You might be right. I was just hoping an `NSRunLoop` alone would be enough... *sigh*... – TooTallNate May 17 '11 at 18:28
  • I completely agree. I really see no reason why `UIApplication` would be required. However, creating a simple GUI application is relatively easy, as you probably know. You need to register `UIApplication`'s delegate, and in it create a `UIWindow`. Then spin the loop using `UIApplicationMain()`. That should be it, no xibs needed. I don't know if you can easily launch a GUI application on a jailbroken device unless you create an .app wrapper in /Applications, though. If you want some sample code, ask either in comments or in a new question (link it); I'll write the code and send you a link. – Ivan Vučica May 17 '11 at 19:41
  • Thanks for the input. However I'm looking to create more of a daemon process that runs without a GUI, and always and in the background. I'm starting to think that I shouldn't be trying to use `UIAccelerometer`, but rather looking at the undocumented/private APIs. I'm not sure which ones I should be using at this time though... – TooTallNate May 18 '11 at 22:15