Detect color of iPhone / iPod [duplicate]

笑着哭i 提交于 2019-12-07 07:20:50

问题


Possible Duplicate:
Detecting Color of iPhone/iPod touch?

Is it at all possible to detect the color of an iPhone / iPod - either natively or in the mobile browser?

I'm working with a designer who would love to make a web app respond to the color of the device.


回答1:


I don't think this is possible. The internal hardware (the "motherboard" keeping all the components together and the components themselves) is manufactured without any knowledge about the final casing. The same is true for the software (firmware and iOS), since all devices get an equal copy of exactly the same software, byte for byte identical, except for any serial numbers that might be embedded in the firmware. It might be the case that Apple uses different device serial number ranges for different casings, yet that is just a wild speculation.

It's like building a car: All components (engine, electronics, etc.) are equally manufactured, regardless with what color the final car will be coated. Actual the car is completely assembled, all hardware and all software, and ready to be used before it is color coated; and up to the last second the final decision how to color it may change.


UPDATE

I did some more investigations on this topic and I found out that the "wild speculation" is not as wild as I assumed it to be. It really seems to be the case that Apple uses different serial number ranges for different device colors. The serial number (as well as similar numbers, like the IMEI of iPhones) are the only parts of the device firmware that are different for each device manufactured.

Apple used the following serial number format in the past (not sure if this is still up-to-date, but it was still up-to-date for the iPhone 4):

AABCCDDDEEE

 AA = ID of the factory that manufactured the device.
  B = Year of production: 8=>2008, 9=>2009, 0=>2010, 1=>2011, etc.
 CC = Week number of the year.
DDD = Production index number, is reset every week, base-34 encoded.
EEE = Model ID.

The interesting value is the "Model ID". The same device generation has different Model IDs depending on their color and the amount of available storage.

I haven't found any complete list of all the possible values, though. And even if there was such a complete list, you still have the problem that you need to keep it up-to-date, since Apple is constantly releasing new models, so the list could be out-dated any couple of months (at least once or even twice a year). Here are some sample values for the last 3 digits of the serial number (EEE):

VR0: iPhone 2G Silver 4GB
WH8: iPhone 2G Silver 8GB
0KH: iPhone 2G Silver 16GB
Y7H: iPhone 3G Black 8GB
Y7K: iPhone 3G Black 16GB
3NP: iPhone 3GS Black 16GB
3NR: iPhone 3GS Black 32GB
3NQ: iPhone 3Gs White 16GB
3NS: iPhone 3Gs White 32GB
A4S: iPhone 4 Black 16GB
A4T: iPhone 4 Black 32GB

I haven't found any sample values for the current iPod generations so far.




回答2:


There's no API exposed for this.

If this is something you'd like Apple to add, you should file an enhancement request at http://bugreporter.apple.com .




回答3:


There is no way to do what you are saying... But there are lots of ways for you to get the color, you could create an UIPickerView and add the possible colors there for the user to choose, for exemple.



来源:https://stackoverflow.com/questions/14263640/detect-color-of-iphone-ipod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!