The iPhone SDK includes a singleton of class type UIDevice that you can use to retrieve device specific information (this works equally as well with the simulator).
Available Properties in UIDevice
uniqueIdentifier – identifier guaranteed to be unique for every device
name – arbitrary name found in General > About setting on device
systemName – name of the OS running on the device
systemVersion – current version of the OS
model- model, such as ”iPhone” or ”iPod touch”
localizedModel – same as above using a localized string
Stats for Simulator
This code will list all stats shown above:
NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]);
NSLog(@"name: %@", [[UIDevice currentDevice] name]);
NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);
NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);
NSLog(@"model: %@", [[UIDevice currentDevice] model]);
NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);
Running the above on the simulator returns:
Stats for iPhone
The device stats when running on my iPhone:
No comments:
Post a Comment