alvarolopez
alvarolopez

Reputation: 467

How can we send device info using MFMailComposeViewCotroller

I've seen in some apps that when you click on a "Feedback" page it shows up an MFMailComposeViewController with some information in the message body like the device type and the iOS version written up already. This is sometimes useful to know when users are reporting problems so you know the device that is having problems.

Is this a built-in characteristic of objective-c or are there any external libraries which make this possible?

Upvotes: 1

Views: 122

Answers (2)

Dipu Rajak
Dipu Rajak

Reputation: 693

You can retrieve though informations.

For iOS Version

NSString *iOSVersion = [[UIDevice currentDevice] systemVersion]

for Device model you can write a function something like below also you need to import #import <sys/utsname.h>

-(NSString *) deviceModelName{
    struct utsname systemInfo;
    uname(&systemInfo);

    NSString *modelName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];

    return modelName;
}

Upvotes: 0

Sviatoslav Yakymiv
Sviatoslav Yakymiv

Reputation: 7935

You can get what you want from UIDevice class.

UIDevice *currentDevice = [UIDevice currentDevice];
NSString *model = [currentDevice model];
NSString *systemVersion = [currentDevice systemVersion];

See article for more information.

Upvotes: 3

Related Questions