iphone-glass

Detect Apple iPhone Model Numbers and User-Agents

Edward

5/15/2017 9:58 AM

Apple Update User Agent Device Data

51Degrees property: HardwareModelVariants

For the latest instructions on how to detect Apple iPhones and iPads please refer to this blog

We recently reviewed the model numbers within the Android User-Agent strings for the Samsung Galaxy S8 and S8+. This week we look closer at User-Agent strings for the Apple iPhone 7.

Please note that this article is not applicable for Native apps and TAC codes as they operate at a precise model level. 51Degrees already support Native Apps as part of our enterprise package.

In many cases Apple obfuscates device information

As evidenced below the User-Agent identifies that the device is an iPhone but gives no model information. Based on the User-Agent alone it would be impossible to tell whether the requesting device was an iPhone 5, iPhone 7 Plus or any other. In these instances there are however some additional techniques that can be employed to help detection, for more information refer to our article on Device Detection for Apple iPhones and iPads.

Apple iPhone 7 User-Agent example that gives no identifier:

Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1

In select cases, most commonly when requested through a web application such as Facebook, Snapchat or Instagram, we are treated with a device identifier. In the example User-Agent below, towards the end of the string you can see 'iPhone9,3'. Unfortunately that's not the end of the chase, but it does give a much clearer picture as to what device is being used.

Apple iPhone 7 User-Agent example that gives an identifier:

Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E304 Instagram 10.10.0 (iPhone9,3; iOS 10_3_1; en_US; en-US; scale=2.00; gamut=wide; 750x1334)

The inclusion of 'iPhone9,3' tells us the device is the Apple iPhone 7. The identifier of 'iPhone9,1' also corresponds to the iPhone 7, the differences between these two is related to the networks. With the iPhone 7 there are four sub model numbers; A1660, A1778, A1779 and A1780, each representing different regions or carriers. None of which are shown in the User-Agent. Considering the future we expect to see a similar pattern for the iPhone 8 due out later this year.

So where does that leave us?

We have four model numbers for the iPhone 7 which cannot be distinguished between via the devices web request, choosing a single one of these four model numbers to represent the iPhone 7 would on average only be correct 25% of the time, even if weight was given through popularity this wouldn't come close to the accuracy we pride ourselves on.

The answer is a property entitled 'HardwareModelVariants'

This property will return two or more associated model numbers of a device where a single unique identifier is unavailable. Where a single identifier for a device is available then this property will instead return N/A.

Property: HardwareModelVariants

Description: Indicates all model numbers used by the hardware vendor to identify the device. This property compliments 'HardwareModel', e.g. Hardware Model Variants A1660 and A1778 correlate to the iPhone 7 Hardware Model.

Again, please note that this article is not applicable for Native apps and TAC codes as they operate at a precise model level. 51Degrees already support Native Apps as part of our enterprise package.

All code and methods shared in our blogs are only relevant as long as Apple do not block the information that can be accessed.