Detect iOS and iPad iOS versions properly.

This patch adds detection for iOS and iPad iOS versions.