I have sample code as below in viewDidLoad to detect hotspot on / off. It working properly in iPhone 6-8 but crashed in iPhone X.
UIApplication *app = [UIApplication sharedApplication];
if(![[app valueForKey:@"statusBar"] valueForKey:@"doubleHeightLabel"])
{
//Some code here
}
else
{
//Some code here
}
Error Message shown:-
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIStatusBar_Modern 0x7ffed341b7f0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key doubleHeightLabel.'
Any idea?