Uidevice get device data and how to get app information

Source: Internet
Author: User

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
  1. Access to equipment-related information
  2. NSString *strname = [[Uidevice currentdevice] name];
  3. NSLog (@"Device Name:%@", strName);
  4. NSString *strid = [[Uidevice currentdevice] uniqueidentifier];
  5. NSLog (@"device Unique ID:%@", Strid);
  6. NSString *strsysname = [[Uidevice currentdevice] systemName];
  7. NSLog (@"system name:%@", strsysname);
  8. NSString *strsysversion = [[Uidevice currentdevice] systemversion];
  9. NSLog (@"System version number:%@", strsysversion);
  10. NSString *strmodel = [[Uidevice currentdevice] model];
  11. NSLog (@"Device mode:%@", Strmodel);
  12. NSString *strlocmodel = [[Uidevice currentdevice] Localizedmodel];
  13. NSLog (@"Local device mode:%@", Strlocmodel);
  14. float Version = [[[Uidevice Currentdevice] systemversion] floatvalue];
  15. NSLog (@"version number:%f\n", version);
  16. //app Application-related information acquisition
  17. Nsdictionary *dicinfo = [[NSBundle mainbundle] infodictionary];
  18. Cfshow (Dicinfo);
  19. NSString *strappname = [dicinfo objectforkey:@"Cfbundledisplayname"];
  20. NSLog (@"app App Name:%@", strappname);
  21. NSString *strappversion = [dicinfo objectforkey:@"cfbundleshortversionstring"];
  22. NSLog (@"app version:%@", strappversion);
  23. NSString *strappbuild = [dicinfo objectforkey:@"Cfbundleversion"];
  24. 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" >
    1. @property (nonatomic,readonly,retain) nsstring *uniqueidentifier Ns_deprecated_ios (2_0, 5_0);
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.