Why create your own static library? Well, it's for the 13. Well, as an excellent program ape, I will not let go of any one of the 13 skills, share a skill today--build your own static library.
No kidding, the bottom of the official start.
First, use Xcode to create a new project, as follows:
See Clearly, you must select the "Static Library" this.
Second, give you a static library name, this link I skipped. It's the project I created.
2.1, in the header file, you want to open the name of the method is written here, (the example method is to enter a thousand-bit representation of the amount of string, converted to the integer number)
2.2. Write the implementation part in the. m file.
2.3, note that the left navigation bar in the "Products" folder under the "libdemo.a" file is red, which means that there is no such file, at this time in the simulator and the real machine compiled once, will appear this. a file.
Note that before compiling, be sure to change the mode to release mode, such as:
When you are finished modifying it, compile it:
2.4, at this time, we on the. a file "show in Finder", you will see the following files: One is the real machine under the generated folder, and the other is generated under the emulator folder
At this point, the. A file is already the static library we want, but when used, we need a. A, in the real environment we have to use another, a, this is very troublesome, there is no way to let them merge together? There is a way to do this: enter the following command in the terminal to merge two. a Files
Lipo-create/path/release-iphoneos/libyy.a/path/release-iphonesimulator/libyy.a -output/users/quanzheng/desktop /libyy.a
At this point press ENTER, then go to the desktop to see, there will be a static library silently lying on the top
At this time only. A file, missing the header file, how to do? All right, go to the project and pull out your head file.
OK, now this pair of files is the static library we dreamed of loading 13, and we dragged them into the new project and tried to see how.
The first is the experiment in the simulator environment, the input string "100,000 yuan", the expected output "100000"
For example, OK, no problem. We're looking at how it behaves in a real machine:
Well, no problem. OK, now you can hold the static library happy to pack 13 ~
iOS development, creating your own static library