0

I'm a starter in obj-c programming and I need to know how to display device info ( name, device type, ios version )

I you know the answer, please tell me and keep in mind i'm a starter with xcode ;)

BergQuester
  • 6,167
  • 27
  • 39
  • Follow this Link for device detection http://stackoverflow.com/questions/8292246/how-to-programmatically-differentiate-between-iphone-4-and-iphone-4s – Adnan Munir Jul 17 '14 at 18:20

4 Answers4

3

I've used these information in an App that I developed so I did the following code. I think this may help you. I just didn't understand what you mean with device type.

To get the device model:

// get model from UIDevice
NSString *modelDevice = [UIDevice currentDevice].model;

To get the iOS Version:

//get the iOS version
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];

To get the device name:

/** Method responsible to get the device name
 *
 * @return device Name
 */
+ (NSString *)deviceName
{
    size_t size;

    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithUTF8String:machine];
    free(machine);

    return platform;
}
Eduardo Urso
  • 296
  • 3
  • 6
0

Please refer to UIDevice Class. It has all accessible system information properties. This is a singleton class. You can access this class instance like this : [UIDevice currentDevice]

For example if you want to access device model, you can access like this :

[UIDevice currentDevice]. model

Please refer this link to get information about all properties : https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html

Naga Mallesh Maddali
  • 1,005
  • 10
  • 19
0

You may try something like this: I use this for in-app support emailing from users.

#import <sys/utsname.h>

- (void)yourMethod
{
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *appVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    NSString *osVersion = [[UIDevice currentDevice] systemVersion];
    NSString *machine = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}
klcjr89
  • 5,862
  • 10
  • 58
  • 91
0
    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])

;
Nazim
  • 64
  • 3