In the application development process of iOS app, it is sometimes necessary to collect user device, System information, application information and so on automatically.
For example, in the app to collect user feedback function, not only the user's feedback can be submitted to the server, including the above information is also automatically submitted to the server. This is especially useful for user feedback bugs. Here's how they get it:
[CPP]View Plaincopy
- Access to equipment-related information
- NSString *strname = [[Uidevice currentdevice] name];
- NSLog (@"Device Name:%@", strName);
- NSString *strid = [[Uidevice currentdevice] uniqueidentifier];
- NSLog (@"device Unique ID:%@", Strid);
- NSString *strsysname = [[Uidevice currentdevice] systemName];
- NSLog (@"system name:%@", strsysname);
- NSString *strsysversion = [[Uidevice currentdevice] systemversion];
- NSLog (@"System version number:%@", strsysversion);
- NSString *strmodel = [[Uidevice currentdevice] model];
- NSLog (@"Device mode:%@", Strmodel);
- NSString *strlocmodel = [[Uidevice currentdevice] Localizedmodel];
- NSLog (@"Local device mode:%@", Strlocmodel);
- float Version = [[[Uidevice Currentdevice] systemversion] floatvalue];
- NSLog (@"version number:%f\n", version);
- //app Application-related information acquisition
- Nsdictionary *dicinfo = [[NSBundle mainbundle] infodictionary];
- Cfshow (Dicinfo);
- NSString *strappname = [dicinfo objectforkey:@"Cfbundledisplayname"];
- NSLog (@"app App Name:%@", strappname);
- NSString *strappversion = [dicinfo objectforkey:@"cfbundleshortversionstring"];
- NSLog (@"app version:%@", strappversion);
- NSString *strappbuild = [dicinfo objectforkey:@"Cfbundleversion"];
- NSLog (@"app build version:%@", strappbuild);
However, after IOS5, the interface that originally acquired the device ID of the iphone:[[uidevice currentdevice] uniqueidentifier] was abandoned. The definition of uinqueidentifier in UIDevice.h is as follows:
[CPP]View Plaincopy < param name= "wmode" value= "Transparent" >
- @property (nonatomic,readonly,retain) nsstring *uniqueidentifier Ns_deprecated_ios (2_0, 5_0);
- A string unique to each device based on various hardware info.
This means that iOS2.0 and iOS5.0 systems are available, but are not recommended for use. It is possible for Apple to remove the function after ios5.0.
Tested, jailbroken iphone with a system version of 5.0.1, you can still get udid.
Uidevice get device data and how to get app information