Search code examples
iosobjective-ciphoneproximityproximitysensor

iPhones proximity sensor gives wrong data


I'd implement checking proximityState property that tells me if user have phone near his ear. Like he is making a phone call. In iOS 7 works, but then I had to remove this feauter due to other reasons. Now on iOS 8 I add this feature in app and efter the proximity change its state to YES for the first time in stays YES forever. It's not switched to NO not even when you remove the device from your ears. Looks like it kind of a bug in ios, has anybody else having this same issue.

Thanks.


Solution

  • So I found the problem. self.device.proximityState should be read on main thread. All the work was done in the background threat and if I check proximityState on main thread it works.