Summary of differences between iOS 6 and earlier versions

Source: Internet
Author: User

1. Adapt to 4 inch screen adaptation.

To adapt to the 4 inch screen, the system creates a default-568h@2x.png image and identifies whether the system supports the 4 inch screen based on the resource. As for other resources, xxx-568h.jpg is not allowed to be used to adapt to the screen. You need to use the code to detect the screen for adaptation.

2. uinavigationviewcontroller changes

As found during the development process today, the initwithrootviewcontroller of this class will eventually call the init method in previous versions. Therefore, when inheriting uinavigationviewcontroller, you can directly override the init method to initialize the required attributes of the object. However, the init method is not called on ios6, so developers need to pay attention to it.

3. cfrelease changes

In earlier versions, if cfrelease is allowed to pass in nil, it does not affect our program, but in ios6, in this way, the program directly drops your program crash, so you need to determine whether NIL is safe in the code.

4. uipickerview changes

In earlier versions, calling [_ pickerview selectrow:-1 incomponent: 0 animated: Yes]; is allowed. However, ios6 may cause a crash.

5. Changes in uiactivityindicatorview

In earlier versions, if the startanimating method is called, you only need to add the uiactivityindicatorview to the subview to display the loaded animation. However, in ios6, if you remove the display queue, the animation is stopped, this control is especially added to uitableviewcell. As long as the uiactivityindicatorview of the cell is rolled for several times, it disappears. To solve this problem, you can determine whether to execute an animation based on the isanimating attribute when adding the display queue, if not, call the startanimating method again.

6. Differences in obtaining the address book list

To obtain the address book list after ios6.0, you need to ask the user. After the user's consent, you can obtain the address book user list. In addition, the initialization of abaddressbookref is also changed from the abaddressbookcreate function to the abaddressbookcreatewitexceptions function. The following code is compatible with the previous version to obtain the address book user list.

[CPP]
View plaincopyprint?
  1. + (Nsarray *) abcontacts {
  2. Float version = [uidevice currentdevice]. systemversion. floatvalue;
  3. Nsmutablearray * ret = nil;
  4. If (version> = 6.0)
  5. {
  6. Nslog (@ "get contacts by> = 6.0 API ");
  7. Abaddressbookref addressbook = abaddressbookcreatewitexceptions (nil, nil );
  8. // Execute the code below after waiting for consent
  9. Dispatch_semaphore_t Sema = dispatch_semaphore_create (0 );
  10. Abaddressbookrequestaccesswithcompletion (addressbook, ^ (bool granted, cferrorref error)
  11. {
  12. Dispatch_semaphore_signal (SEMA );
  13. });
  14. Dispatch_semaphore_wait (Sema, dispatch_time_forever );
  15. Dispatch_release (SEMA );
  16. Cfarrayref ppref = abaddressbookcopyarrayofallpeople (addressbook );
  17. Ret = [nsmutablearray array];
  18. For (ID record in (nsarray *) ppref ){
  19. @ Try {
  20. Contact * Contact = [contact contactwithabrecordref: Record];
  21. // Nslog (@ "contact name = % @", contact. compositename );
  22. [Contact initforsearchwithrecord: Record];
  23. // Nslog (@ "init for search ");
  24. [RET addobject: Contact];
  25. }
  26. @ Catch (nsexception * exception ){
  27. }
  28. @ Finally {
  29. }
  30. }
  31. Nslog (@ "AB size = % d", [RET count]);
  32. Cfrelease (ppref );
  33. Cfrelease (addressbook );
  34. } Else {
  35. Nslog (@ "get contacts by <6.0 API ");
  36. Abaddressbookref addressbook = abaddressbookcreate ();
  37. Cfarrayref ppref = abaddressbookcopyarrayofallpeople (addressbook );
  38. Ret = [nsmutablearray array];
  39. For (ID record in (nsarray *) ppref ){
  40. @ Try {
  41. Contact * Contact = [contact contactwithabrecordref: Record];
  42. // Nslog (@ "contact name = % @", contact. compositename );
  43. [Contact initforsearchwithrecord: Record];
  44. // Nslog (@ "init for search ");
  45. [RET addobject: Contact];
  46. }
  47. @ Catch (nsexception * exception ){
  48. }
  49. @ Finally {
  50. }
  51. }
  52. Cfrelease (ppref );
  53. Cfrelease (addressbook );
  54. }
  55. Return ret;
  56. }

Related Article

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.