//I have created below snippet to let the sensor to be detected.
-(void)addProximitySensorControl {
UIDevice *device = [UIDevice currentDevice];
device.proximityMonitoringEnabled = YES;
BOOL state = device.proximityState;
if(state)
NSLog(@"YES");
else
NSLog(@"NO");
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(proximityChanged:)
name:@"UIDeviceProximityStateDidChangeNotification"
object:nil];
}
iPhone 3GS以前のproximityChanged:メソッドは正常に呼び出されましたが、iPhone 4では、オブジェクトを上からホバリングしているときにセンサー(画面)が検出されません。アイデアはありますか?