Reputation: 4924
I'm getting an "unrecognized selector sent to instance" error message on my iPhone that I can't figure out. I'm running the native iOS source from XCode, and I get stuck during initialization with this error message when I call the setInterval() method.
The method is simple. I'm using the sensors, so I have this interface
public interface SensorsNative extends NativeInterface {
...
void setInterval(int type, int delayMicroSeconds);
}
My ios native implementation looks like this:
-(void)setInterval:(int)type delay:(int)delayMicroSeconds {
// accelerometerUpdateInterval is in seconds.
NSTimeInterval delaySeconds = delayMicroSeconds / 1000000.0;
if (type == GYRO) {
[motionManager setGyroUpdateInterval: delaySeconds];
} else if (type == ACCEL) {
[motionManager setAccelerometerUpdateInterval:delaySeconds];
} else if (type == MAGNET) {
[motionManager setMagnetometerUpdateInterval: delaySeconds];
}
}
My SensorsNative instance is static, so it can't get garbage collected, and I can see from the attached Xcode output that my parameters have the right values, and ptr, my pointer, is of the right type. I can't figure out why it doesn't work.
Upvotes: 1
Views: 39
Reputation: 4716
It looks like you changed the name of your native implementation iOS method. It should be setInterval:param1:
, but you changed it to setInterval:delay:
e.g.
-(void)setInterval:(int)type param1:(int)delayMicroSeconds {
...
}
Upvotes: 2