calculateStatusBarAreaAvgLuminance throw error Thread 8: EXC_BAD_ACCESS (code=1, address=0x20) at line 74 layer.render(in: context) but I checked both layer and context and they are not nil. I have a view covers the full screen, including the status bar, I guess that's might be the reason.