correctly check ios version

The previous way crashed on anything below iOS8.