Ios::.a generation, as well as the simulator and the real machine. A merge

Source: Internet
Author: User

    • First, let's talk about why you should use the. A file objective-c language has a. h. m file. A static library can encapsulate. m files as a. A file, and third-party applications only need to get this. A file and the code corresponding to the. h file can be used to encapsulate the method in the static library. The iOS static library is a good place to create a third-party SDK. Step 1 First create a new project, select the framework
      &:, in select Cocoa Touch Static Library project name own definition

      Bb2eca5b-8795-4eca-88af-d2fb0f8ba382.png
      2. Next you will see the automatically generated. h and. m files can write the code you want in the. m file

      F1898d4b-a084-488b-8170-a8de5682136b.png
      3. Let's create a simple code
      The. h file is as follows

      D8ee5b3d-a2b4-4cfc-af6d-1b31cb1be250.png
      The. m file is as follows

1560d4fd-1030-4643-aa44-7070c028d2d3.png


4. The next step is to compile and generate the. a file.
Shortcut key (command+b) check the true machine compile and check the simulator to compile the corresponding generated connection. A file one is a real machine, one is a simulator.


5ab668de-a882-4ea5-b3aa-f7c67fb650b7.png

This is the time to find the compiled. A file in the repository.
Navigate to and then press the option shortcut key you will see the repository click




998f053b-cd9a-455c-8b88-cf0a72b7c8b7.png

See Release-iphoneos and Release-iphonesimulator inside the. a file


5ab668de-a882-4ea5-b3aa-f7c67fb650b7.png


4. The next step is to introduce your generated. A file into the project you want to join.


4ff87073-d14f-4d6d-964a-78a59b155743.png


Introduction Method: Directly drag all the. h files in the include folder you see and the corresponding. A files below directly to your project. Three options


Fb518732-a5e0-419e-8a92-8b07803a83c4.png
D5b5f50f-5a90-48c1-b669-de1f8e5b740b.png


5. Once added, you can use it directly, but be aware that if you are selecting Simulator build. A file will be error when running the real machine, so in order to use the real machine and the simulator can be used. A file can be combined into a. A file using terminal synthesis in the following ways:
zxydemacbook-pro:~zxy$ lipo-create Simulator. A (path) real machine. A (path) -output can copy and rename the. A of the simulator. A
In this way, it can be combined into a common static library, the only drawback is that the volume is larger relative to the total size of the real machine and simulator two, then drag the static library into the project can

------------Split Line------
As I see the questions that you have raised on iphones 4s and the inability to use on iphone 5 later, consult various data to find the answers to the following:
The reason is because the static library is less 4s~5:i386 the corresponding CPU architecture
As shown in the following:
On the CD to the repository your. A file is located in the path and then use the following command to view:
Lipo-infor *. A
The displayed results are as follows


3ef5e4d6-69fc-4e68-a64d-df8a93f5ee45.png

Just go to your. A project to find as debug will change yes to No and then re-commond + B to recompile Select all the emulators to compile and then go back to the steps of your work again happy to come again the problem is OK!!!

Ios::.a generation, as well as the simulator and the real machine. A merge

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.