I have a function that requires distance detection, but I find a confusing problem. Every time something approaches for more than 1 second, it will go black. Can I stop the black screen on the premise of starting distance detection
[UIDevice currentDevice].proximityMonitoringEnabled=YES;[[NSNotificationCenter
defaultCenter] addObserver:self selector:@selector(proximityStateDidChange:) name:UIDeviceProximityStateDidChangeNotification object:nil];
- (void)proximityStateDidChange:(NSNotification *)note
{
if ([UIDevice currentDevice].proximityState) {
NSLog(@"...");
} else {
NSLog(@"...");
}
}
CodePudding user response:
Through my extensive review, I found that it was impossible to solve the problem