Mac_xcode compile iOS Static library

Source: Internet
Author: User

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

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.