I am trying to determine if my code is running on an iPhone or an iPhone3G. My first try was to use the UIDevice class in UIKit, but both iPhone and iPhone3G return the same responses:
NSLog([[UIDevice currentDevice] name]); // Name of the phone as named by user
NSLog([[UIDevice currentDevice] uniqueIdentifier]); // A GUID like string
NSLog([[UIDevice currentDevice] systemName]); // "iPhone OS"
NSLog([[UIDevice currentDevice] systemVersion]); // "2.2.1"
NSLog([[UIDevice currentDevice] model]); // "iPhone" on both devices
NSLog([[UIDevice currentDevice] localizedModel]); // "iPhone" on both devices
Those are the only parameters that UIDevice allows you to query.
I looked a bit in Foundation Framework but have not yet found the appropriate calls.
I'm sure there is some piece of hardware I could query (such as something in location services) but that seems like a hack. Does anyone know a simply way of determining this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…