iOS development: Run on multiple platforms, devices, and 64-bit architectures

Source: Internet
Author: User

recently in the new project on-line has encountered a lot of adaptation problems, especially the old project 64-bit equipment adaptation, Now, tidy up a bit.

Base SDK vs. Deplyment Target

1. Configure the Base SDK settings

1) Select the project document on the project navigation panel

2) Search the Base SDK on the edit panel

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/27/47/wKiom1Nxn2uSUkobAABEc-GNbzE945.jpg "title=" base Sdk.png "alt=" Wkiom1nxn2usukobaabec-gnbze945.jpg "/>

The Base SDK Settings Bootstrap compiler uses this version of the SDK to compile and build the app, which means it directly controls which APIs are used by the app.

Minimum operating system version required for 2.Deplyment target running app

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/27/47/wKiom1Nxn4DwPSDjAAAtytrqB3E411.jpg "title=" Deployment Target.png "alt=" Wkiom1nxn4dwpsdjaaatytrqb3e411.jpg "/>

Considerations when supporting multiple SDKs:

    1. Framework availability Sometimes the new SDK adds a complete framework that is not available on older operating systems, such as IOS5 's twitter.frame, only for devices that are more than iOS5. Similarly, gamecontroller.framework in the passkit.frameworkios7 of iOS6

    2. Class availability Sometimes the new SDK may have added new classes to the existing framework. This means that even if the framework is linked, not all symbols can be used in earlier operating systems. such as the Nslayoutmanager class defined in IOS7 uikit.framework. Check whether the control is available:

      if ([Nslayoutmanager class]) {       //Use this class   } else {       //   }


Availability of the method

    • Check whether a class has a method:

      if ([Self.view respondstoselector: @selector (settintcolor:)]) {    //Set Tintcolor}


    • If the method of checking volume is a C global function

      if (cfunction! = NULL) {     cfunction (a);}


    • Check the availability of frameworks, classes, and methods

    1. Developer Documentation

    2. Macros in the iOS header file

    • Testing equipment and judgment function
      The correct approach is to detect the availability of hardware or sensors, rather than assume that the device has some functionality.

    • Detecting Hardware and sensors

      IOS6 PTL Examples of source code:

      Https://github.com/iosptl/ios6ptl/tree/master/ch16/UIDeviceAdditions

support for IPhone5 and 5s

Auto layout automatically adjusts Calayer for compatibility with IPhone5


-(void) Viewwilllayoutsubviews {    self.patternLayer.frame = self.view.bounds;    [Super Viewwilllayoutsubviews];}

iphone 5s and the new 64-bit architecture iphone 5s supports a new directive: arm64.

The 64-bit simulator is configured to x86_64 instructions.

Change "architectures" to "standard architectures (including 64-bit)" in "Build Setting"

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/27/6D/wKioL1Ny7XOQT0gNAADN3-Esk78345.jpg "title=" Architecture.png "alt=" Wkiol1ny7xoqt0gnaadn3-esk78345.jpg "/>

The problem of conversion into iOS7 attention

    • Auto Layout

    • Support IOS6

    • Application Icon:ios7 Icon size is different

    • Buttons with no thicker wireframe

    • Tint Color:ios7 New Add Property

    • Artwork UPDATES:IOS7 support more WordArt

transition to 64-bit architecture

The first step is to use Nsinteger, Nsuinteger, cgfloat into float, int. If you compile an app, use Nsinteger to replace the 32-bit integers (int) with a 64-bit integers (long). CGFloat.

the more common problem is , the TableView row high return value is Flaot instead of cgfloat, and the table does not display properly.


Reference Documentation:

"IOS6 Development Practical"

IOS 7: How to compile 64-bit apps for iphone 5S

Developer Documentation: 64-bit Transition Guide


This article is from the "realistic Idealist" blog, please be sure to keep this source http://sookie.blog.51cto.com/5955569/1410391

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.