I want to access the Accelerometer of my iPhone through PyObjC. Here is my Code:
@objc.signature("v@:@@")
def accelerometer_didAccelerate_(self, accelerometer, acceleration):
msgBox = UIAlertView.alloc().initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles_("Acceleration", str(acceleration.x), self, "OK", None)
msgBox.show()
msgBox.release()
@objc.signature("v@:@")
def applicationDidFinishLaunching_(self, unused):
self.accelerometer = UIAccelerometer.sharedAccelerometer()
self.accelerometer.setUpdateInterval_(1)
self.accelerometer.setDelegate_(self)
#...
The problem is str(accelleration.x) returns "<native-selector x of <UIAcceleration: 0x.....>>"
. What can I do?