Compile and use the. A static library of iOS under Xcode
The whole process is similar to vs compiler lib Static library new Static library project
File-> New-> Project, select Static Library template
The project is named Staticlib
The library hasn't been compiled yet, it's red.
Add an interface
Create in staticlib folder
Select the class file to create both the. h header file and the. m implementation file
Named class is Actor
Create
Add code
Actor.h
#import <Foundation/Foundation.h>
@interface actor:nsobject
+ (void) Run;
@end
Actor.m
#import "Actor.h"
@implementation Actor
+ (void) run{
NSLog (@ "---actor.run!");
@end
setting compilation options and compiling
Set compilation options
Compile, Command + B, after the success will be seen in this path LIBSTATICLIB.A Static Library and two oral files (this library of the name and Linux. So dynamic library is very similar to AH)
Create a new app, use a static library
File-> New-> Project, select a single page template
Named MyApp, using the OC language
setting up a connection static library
Create a new group Mylibs(which does not actually create this folder, similar to VS), and then drag the. A library directly under the group to check the Copy option
is automatically added to the connection library. Set header file search path
You can copy the exported header file to a desktop or other place, where you refer to the header file, where the desktop
Set Search Path
using the static library interface
Compile run Command + R, you can see the results