静态库的制作详解

静态库的制作

    1   静态库的存在形式: .a .framework

         动态库的存在形式:.dylib .framework

 

   2   静态库和动态库的区别: 静态库在链接的时,会被完整的复制到可执行文件中,被使用多次,就由多份拷贝。

                                                         动态库则不会被复制,只有一份,程序运行时,动态加载到内存,系统只加载一次,多个程序共用

        但是:程序中如果使用自己的动态库是不允许上架的。

   3   使用静态库,可以保护核心代码,将MRC的项目打包成静态库,就可以在ARC环境下直接使用。

   4   静态库的特点: .a(静态录库) + .h  看不到具体实现的代码

 

演练:一般情况下如果有个别mrc文件需要参与到编译中,可以做如下改动,但是有很多的话,需要使用静态库。MRC的项目打包成静态库,在ARC环境下也可以使用。

计算机生成了可选文字:
112 陟 
Ⅱ h'A 吅 O • 
m AppDM•gat•n 
M n 02d 
- 鷢 12 ~ J ” 
18 步 ” 
R • 
S ~ 
嚷 你 发 c 塽 . 甪 嫠 , # 一 
-fbn -ObjC -arc

(二)静态库的制作

<>.a静态库的制作:

1、创建一个静态库(选右边的是.a的静态库的制作,选左边的是.framework的静态库的制作)

计算机生成了可选文字:
Choose a template for your new project: 
Cocoa Touch 
Static Library 
Application 
Framework & Library 
Application 
Framework & Library 
Application 
Framework & Library 
os x 
Application 
Framework & Library 
System Plug-in 
Cocoa Touch 
Framework

创建的静态库中的文件和静态库的名称是一样的。

 

2、假使你有一个项目文件,需要生成一个静态库。

计算机生成了可选文字:
test 
ZJTooIs.h 
m ZJTooIs.m 
2 
ZJT001s.h 
test

在模拟器上生运行的成静态库

计算机生成了可选文字:
Q 
h ZJTools.h 
m ZJTooIs.m 
Products 
libtest.a 
G) 
tes 
iPhone Bs 
#corfiimld + B

在真机上生成的静态库

计算机生成了可选文字:
•Latest 
h ZJTools.h 
m ZJTooIs.m 
Products 
Iibtest.a 
"zhuzhu"ä iPhone 
88 
cOmiWähd +

点击libtest.a,showinFinder

计算机生成了可选文字:
“ 甴 乙 
0 
亡 
. Debua-lOhoneos 
Iibtest.a 
个 在 真 机 上 跑 得 静 态 库 , 个 在 模 拟 器 上 跑 得

但是要想将文件打包给别人,还需要一个.h文件。可以直接将.h文件拷贝过来,但是如果项目很大,有很多

.h文件,这个时候就比较麻烦,可以选择这样操作:

计算机生成了可选文字:
Resource Tags 
Build Settings 
Build Phases 
Build Rules 
e 
PROJECT 
test 
test 
h ZJTools.h 
m ZJTooIs.m 
Products 
Iibtest.a 
Target Dependencies (O items) 
Conwe Sources (I item) 
Link Binary With LiVaries (O items) 
Copy Files (I item) 
Destination Products Directory 
subpath 
n 
Copy only when instal ing 
h ZJTooIs.h ...in test

然后,再编译一下!!!就可以运行了

计算机生成了可选文字:
Debug-iphoneos 
Debug-iphonesimulator 
include 
libtest.a 
h ZJTools.h

测试静态库:

将生成的模拟器的文件导进来

计算机生成了可选文字:
Iibtest.a 
h ZJTools.h 
p ega e. 
m AppDeIegate.m 
h V•ewControIIer.h 
WewControIIer.m 
Main.storyboard 
Assets. xcassets 
Launch Screen. storyboard 
17 — 
Info.plist 
Supporting Files 
20 
22 — 
25 
8 
9 
11 
12 
13 
14 
15 
16 
18 
19 
21 
23 
24 
26 
27 
#im ort 
#1mpor 
cend 
"ViewCont roller. h" 
Too s. 
er ( ) 
@implementation ViewController 
(void) viewDidLoad 
(super viewDidLoadJ ; 
// Do any additional setup after loading the view, 
typically from a nib. 
(void) touchesBegan: (NSSet«UITouch *)touches withEvent: 
Products 
(UIEvent *)event 
IZJT001s ; 
cend 
2ø15-11-1ø

需要的注意的地方:

1 、在模拟器上面,就用静态库生成的模拟器的包,如果不用,会报错!!!!

2、在6s65s5s以上)编译都可以成功,但是选用iphone5就会报错。

计算机生成了可选文字:
iPhone 5 
Finished rt 
ViewContr 
Created b 
Copyright 
#import "View 
2 
5 
6 
8 
9 
By Type 
3 issues 
Ignoring file 'Users,'base'Desktop/ 
file wa... 
referenced from: 
O Linker command failed with exit code 
I (use -v to see invocation)

原因是:架构不同

计算机生成了可选文字:
不 同 机 型 的 CPU , 对 应 的 架 构 不 
5s--—6sPlus : x86 6 
3gs--4s : armv7 
Sc : a 黼 丷 酬 armv7 蒹 客 m 丷 副 
5s---6sPlus: arm64 
鬢 , 态 霪 支 持 的 梅 . | 霪 文 件 
问 描 : 
悠 样 一 次 聾 支 持 多 个 梅 的 的 , 态 霪 ? 
幫 决 方 案 : 
正 幫 情 况 、 鴛 选 中 每 一 个 犧 拟 器 进 行 潷 , 生 成 支 对 应 构 的 态 库 . 然 后 合 川 幫 鑫 
B 山 Settings 。 Build Active ” NO , 表 示 不 止 译 活 跃 的 让 所 有 的 架 构 擲 潷

查看架构,终端:

计算机生成了可选文字:
Debug-iphonesimulator — bash — 80x24 
Last login: Tue Nov le 11:49:40 on ttysøøø 
bases cd 'Use rs/base/Library/DeveIope r/Xcode/De rivedData/tes 
t—ctce rugazcl Ivshezqj aqaznvjed/BuiId/Products/Debug—iphonesimuIato r 
bases lipo —info Iibtest.a 
input file Iibtest.a is not a fat file 
Non—fat file: Iibtest.a is architecture: x86 64 
bases

计算机生成了可选文字:
」 1 11 • 1 , 「 ㄣ 1 ~ 
O X 1 1 •u 一 - $ 3 
•S 
'U

因为架构不一样,适用的版本不一样,要想都兼容不同的模拟器,可以选择不同的编译器,重新编译,但是也可以

使用另一种方法,更为方便一点:

将yes改为no,编译不活跃的状态下的架构。

计算机生成了可选文字:
test 
h ZJTools.h 
m ZJTooIs.m 
Products 
Iibtest.a 
test) a iPhone 6 
PROJECT 
test 
TARGETS 
test 
test 
Build test: Succeeded 
Resource Tags 
Basic 
Architectures 
Today at 11:40 
uild Settings 
Build Phases 
Build Rules 
build 
test 
Standard architectures (armv7, 
Latest ios oos C 
No v 
arm64 armv7 armv7s 
test 
Levels 
re 
Combined 
Setting 
Architectures 
Base SDK 
ve rc 
Deb ug 
Release 
Valid Architectures 
Setting 
Asset Pack Manifest URL Prefix

再次编译:发现两个个都支持:

计算机生成了可选文字:
Debug-iphonesimulator — bash — 80x24 
Last login: Tue Nov le on ttysøøø 
bases cd 'Users/ base/ Library/DeveIope r/Xcode/De rivedData/tes 
t—ctce rugazcl Ivshezqj aqaznvjed/BuiId/Products/Debug—iphonesimu to r 
bases Ii o —info Iibtest.a 
Architectures in the fat file: Iibtest.a are: 
bases

但是真机调试的还是不可以。

静态库的两个版本,一个是调试版本,一个是发布版本。

计算机生成了可选文字:
2 . 犧 . Debug 本 
. 谵 试 版 本 会 包 含 整 的 符 号 儻 , 以 方 试 
. 谰 试 版 本 不 会 对 代 码 进 行 优 化 
1 . 真 机 . R ea “ 本 
2 . 犧 . R ea “ 本 
发 布 版 本 
悠 样 殳 不 同 版 本 ? . 
. 发 布 版 本 不 会 包 含 整 的 符 号 詹 
. 发 布 版 本 的 歇 行 代 码 进 行 过 优 化 的 
. 发 布 版 本 的 大 小 会 迦 试 版 本 的 貉 小 
. 在 执 行 速 度 方 面 , 发 布 版 本 会 快 , 但 不 意 味 鬢 会 有 显 薯 的 升 
项 目 0 Edit Scheme 0 Run . , Release/Debug 猾 别 邊 行

这个是release模式:

计算机生成了可选文字:
one 6 
Build 
1 target 
Debug 
Release 
Debug 
Release 
test I Build test: Succeeded Today at 12:01 
Arguments 
Options 
Diagnostics 
Build Configurati 
Executable 
Debug Process As 
Launch 
Release 
None 
Debug executable 
f') Me (base) 
Automatically 
Wait for executable to be launched

然后下面的会变红:

计算机生成了可选文字:
000 
test 
test 
m ZJTooIs.m 
Products 
Iibtest.a 
9 test) a iPhone 6 
2 
3 
4 
5 
6 
7

此时,再次编译一下(分别选择模拟器和真机):

showinFinder会出现4个文件夹:

计算机生成了可选文字:
Release-iphoneos 
Debug-iphoneos 
Debug-iphonesimulator 
Release-iphoneos 
Release-iphonesimulator 
include 
libtest.a 
iates

做测试:在release下面,会出现不打印的情况。这个时候需要做得更改就是,将release模式改为debug。

计算机生成了可选文字:
V 2MmtrcIt_er.' 
Creati 15,'IW3. 
Conright c AIL ri*tE reservi, 
s "nort Wi&Ccntr0LIer.Y' 
Urterfa:e n 
"SArr* *array : n 
NSLog(7V, array); 
; ; Dispose of am,' re*urces tiat can be rxreated, 
32 
SArray array at:w, value 
have bæn optinied cut'

所以最后我们一般给别人的,是生成的release模式下的静态库。

<>.framework静态库的制作:

1

计算机生成了可选文字:
Choose a template for your new project: 
Application 
Framework & Library 
Cocoa Touch 
watch OS 
Framework 
Application 
Framework R Library 
Application 
Framework & Lib 
Cocoa Touch 
Static Library

但是这边有一个问题,需要手动勾选一下,是静态库还是动态库,因为动态库也是有.framework文件的。

(在后面有提示到!!!!!)

2、测试用的代码:

计算机生成了可选文字:
fram 
.k test 
iPhone 6s Plus framework test: Ready I Today at 12:31 
framework test) ZJTooI.m ) *log 
framework test 
2 
5 
6 
8 
9 
10 
11 
12 
13 
14 
15 
16 
ZJT001.m 
framework test 
Created by base on 
copyright 0 2ø15# 
#import "ZJTool. h" 
@implementation ZJTool 
+ (void) log 
NSLog 
framework test 
framework test 
ZJTool.h 
U Tool. m 
Info.plist 
framework testTests 
Products 
15/0/19. 
base. All ric

3、将.h文件暴露出去。

计算机生成了可选文字:
framework test 
framework test 
h ZJTool.h 
m ZJTooI.m 
C) Info.plist 
framework testTests 
Products 
tram... 
k test 
iPhone 6s Plus framework test: Ready 
framework test 
Today at 12:32 
PROJECT 
framework test 
e framework test 
framework test Tests 
General 
Build Settings 
Build Phase 
Resource Tags 
Target Dependencies (O items) 
Conwe Sources (I item) 
Link Binary With LiVaries (O items) 
Headers (I item) 
Public 
h Z.JTool.h 
Project 
(0) 
.in framev.ork test 
Add private header files he 
Add project header files he

正常上面的操作完成后,会编译成功,但是报错了,我做了如下尝试:

修改项目的名称:

1、在创建文件的时候,将下面的勾去掉

计算机生成了可选文字:
Product Name: 
Organization Name: 
Organization Identifier: 
Bundle Identifier: 
Language: 
base 
com.520it 
com.520it.ProductName 
Objective-C 
Include Unit Tests

2、这次的项目名称是test1,(猜测是因为我上面项目中有空格)

计算机生成了可选文字:
testl 
testl 
h ZJTool.h 
m ZJTooI.m 
Info.plist 
testl framework 
PROJECT 
test I 
testl 
General 
Resource Tags 
Target Dependencies (O items) 
Conwe Sources (I item) 
Build Settings 
Build Phases 
e 
Link Binary With Libraries (O items) 
Headers (I item) 
h Z.JTool.h 
(0) 
Project 
(0) 
.in test I 
Add private header files here 
Add project header files here

选择模拟器和真机分别编译。

点击test1.framework,showinFinder

计算机生成了可选文字:
Debug-iphoneos 
Debug-iphonesimulator 
1 .tramework 
testl_framework 
Headers 
Info. plist 
test 1

这个也是同样地可以通过命令行可以查看,因为生成的

计算机生成了可选文字:
basedeMacBook—Pro: Products bases cd 'Use rs/base/Library/DeveIope r/Xcode/De rivedD 
a f pokwo fnqx rcdykx roducts/Debug—iphoneos/testI . f rame 
wo rk 
framework bases lipo —info 'Users/ base/ LibrarWDeveIoper 
/Xcode/De rivedDa f pokwo I f nqx rcdykx roducts/Debug—iphon 
eos/testl. f ramewo rk/testl 
Non—fat file: / Use rs/base/LibrarWDeveIope r/Xcode/De rivedData/testI—cpfpokwoIfnq 
xrcdykxrxakfhgpu/BuiId/Products/Debug—iphoneos/testI. framework/testl is architec 
ture: arm64 
framework base$

3、同样的,不同的模拟器以及真机,使用的架构不一样,所以可以这样操作:

真机上面需要编译一次,模拟器上面也需要编译一次

计算机生成了可选文字:
h ZJTool.h 
m ZJTooI.m 
Info.plist 
Products 
testl -framework 
Resource Tags 
Combined 
Build Settings 
Levels 
Build Phases 
active 
testi 
testi 
Build Rules 
General 
Basic 
PROJECT 
test I 
testl 
Architectures 
Setting 
Build Active Architecture Only 
Deb ug 
Release 
Apple LLVM 7.0 - Warnings - C.. 
Setting 
Nonvirtual Destructor

4、测试framework静态库

计算机生成了可选文字:
testl -framework 
m AppDeIegate.m 
h V•ewControIIer.h 
Main.storyboard 
18 — 
23 — 
24 
X-Xframework"ZE i) m V•ewControIIer.m i) No Selection 
5 
6 
8 
9 
// Created by base on 15/ø9/19. 
// Copyright 0 2ø15# base. All rights reserved. 
#import «test1/ZJTool. 
@interface ViewController ( ) 
cend 
@implementation ViewController 
(void) viewDidLoad 
(super viewDidLoadJ ; 
// Do any additional setup after loading the view, 
typically from a nib. 
(void) touchesBegan: (NSSet«UITouch *)touches withl 
(UIEvent *)event 
IZJT001 log); 
12 
13 
14 
15 
16 
17 
19 
20 
21 
22 
25 
Launch Screen. storyboard 
Info.plist 
Supporting Files 
Products

编译的时候不会报错,但是运行的时候会报错!!!

错误信息如下:

计算机生成了可选文字:
Library not loaded: @rpath/ 
. framework/testl 
Referenced from: /Users/base/ 
Library/Devetoper/CoreSimuIator/ 
Devices/6Ø42F7FØ-EBB9-4A48- 
B22ø-32242C2B2189/data/Containers/ 
Bundle/Apptication/ 
37AØCIE8-Ø29B-4Ø18-ACBØ- 
E. appÆMf ramewo rk*äE 
Reason: image not found 
(Udb)

解决方法:

因为这个静态库是自定义的(本身就是动态库),还需要在动态库的地方添加上去。

这样就可以运行成功!

计算机生成了可选文字:
X-Xframework"ZE 
testl .framework 
•fra...ork"ZE 
Running MIEtframework"ZE on iPhone 6 
iPhone 6 
Build Settings 
Resource Tags 
Hide status bar 
Requires full screen 
enera 
Capabilities 
Build Phases 
Build Rules 
Status 
Required 
Required 
. framework,w 
m 
m 
AppDeIegate.h 
AppDeIegate.m 
'"ewControIIer.h 
VI ewControIIer.m 
Main.storyboard 
Assets. xcassets 
App Icons and Launch Images 
App Icons Source Applcon 
Launch mages Source Use Asset Catalog 
Launch Screen File LaunchScreen 
Launch Screen. storyboard 
C) Info.plist 
Supporting Files 
Products 
Embedded Binaries 
testl -framework 
Linked Frameworks and Lbraries 
Name 
testl -framework 
testl -framework 
..in *IMframeworknZ-E 
2ø15-11-1ø 
Xifframework"ZE 
ø63

但是这个意味着,刚才.frame生成的是动态库,要想生成静态库做如下操作。

计算机生成了可选文字:
testl 
test I 
h ZJTool.h 
m ZJTooI.m 
Info.plist 
uc s 
testi) @ 
"zhuzhu"ä iPhone 
PROJECT 
test I 
TARGETS 
testl 
testl 
Build testl : Succeeded 
Resource Tags 
Today at 13:34 
Build Settings 
Build Phases 
mach- 
I e testi 
Build Rules 
test I 
General 
Basic 
Linking 
Combined 
Setting 
Mach-o Type 
Levels + 
Static Library

这个时候再次编译一下,生成的才是静态库。

直接测试:

计算机生成了可选文字:
X-XframeworknZE 
testl -framework 
A x-Xfra...ork"ZE 
iPhone 6 
Running MIEtframework"ZE on iPhone 6 
X-Xframework"ZE 
Resource Tags 
Hide status bar 
Requires full screen 
Build Settings 
Build Phases 
Build Rules 
Status 
Required 
General 
Capabilities 
m 
m 
AppDeIegate.h 
AppDeIegate.m 
VI ewControIIer.h 
'"ewControIIer.m 
Main.storyboard 
Launch Screen. storyboard 
App Icons and Launch Images 
App Icons Source Applcon 
Launch mages Source Use Asset Catalog 
Launch Screen File LaunchScreen 
Embedded Binaries 
Add embedded binaries here 
Linked Frameworks and L braries 
testl -framework 
C) Info.plist 
Supporting Files 
Products 
2ø15-11-1ø 
Xifframework"ZE 
974 
. f ramewo

上述生成的是debug版本,想生成的release版本,和.a静态库的做法是一样的(参照上面)

5.a静态库和. framework静态库有什么区别:

.a静态库是一个纯二进制文件,.framework中除了有二进制文件之外还有资源文件

.a文件不能直接使用,至少要配合.h文件,.framework文件可以直接使用

.a + .h +sourceFile = . Framework

建议使用. Framework

6、静态库开发中常见的问题:

(1)有些第三方库会使用的图片以及素材,这写素材放在哪里?

由于Xcode默认在编译的时候,会把所有的素材文件导入到mainbundle中,可能与使用静态库文件冲突。

解决方法:在静态中使用bundle文件夹。在资源图片等放到这个包中。

计算机生成了可选文字:
Info. plist 
resource. bundle 
ZJTool.h 
ZJTool.m 
test 1 
testl .xcodeproj

(2)如果需要暴露的头文件过多,怎么办?

建议用一个主头文件包含其他文件,单独泄露出去。

计算机生成了可选文字:
test I 
test I 
m ZJTooI.m 
Info.plist 
Products 
testl -framework 
testi 
iPhone 6s 
testl Build testl: Succeeded 
Today at 13:50 
UI Test Case 
Class 
Objective-C File 
Metal File 
Choose a template for your new file: 
iOS 
Source 
User Interface 
Core Data 
Apple Watch 
Resource 
Other 
watch OS 
Source 
User Interface 
Core Data 
Resource 
Other 
Cocoa Touch 
Class 
Swift File 
Unit Test Case 
Class 
h 
Header File 
Playground 
c 
C File

计算机生成了可选文字:
h ZJTool.h 
Headerh 
m ZJTooI.m 
Info.plist 
Products 
testl -framework 
5 
6 
8 
9 
10 
11 
12 
13 
14 
Header. h 
testl 
Created by base on 15/ø9/19. 
Copyright 0 2ø15# base. All 
#ifndef Header h 
#define Header_h

3)如果想调试静态库怎么办?创建复合文件!

计算机生成了可选文字:
I 〈 〉 I 复 合 顼 目 的 德 试 1 
Q e 
匚 、 
囗 
General 
Resource Tags 
Build Settings 
Build Phases 
vL . 」 复 合 顼 目 的 德 试 1 
PROJECT 
h AppDelegate.h 
复 合 顼 目 的 德 试 1 
m AppDelegate.m 
TargetDependencies(litem) 
h V•ewController.h 
公 复 合 顼 目 的 德 试 1 
ZJT• 。 。 I( 复 合 琰 目 的 瀏 试 1 , 
m V•ewController.m 
Main.storyboard 
添 加 依 
LaunchScreen.storyboard 
InfO.pliSt 
C 。 " Sources e " , 
L 」 
, Link BinaryWith Li “ m 
CopyBundleResources(3items) 
, 、 复 合 顼 目 的 德 试 1 . app 
, 丿 libZJT001.a 
匈 霪 一 硬 目 
, 点 击 下 面 的 + 鬲 . 懂 加 千 个 的 杰 訌 
胚 要 愫 一 个 俄 ,

 

计算机生成了可选文字:
•Delegate.h 
•Delegate.m 
ntroller.h 
ntroller.m 
in.storyboard 
InchScreen.storyboard 
).plist 
»orting Files 
Moo I.a 
iPhone 6s Plus Running on iPhone Es Plus 
Resource Tags 
Build Settings 
Drag to reorder frameworks 
Build Phases 
Build Rules 
Status 
Required 
General 
Capabilities 
cies (I item) 
ZJTool 
Conwe Sources (3 items) 
Link Binary Wit LiVaries (I item) 
libZJTool.a 
Copy Bundle Resowces (3 items)

 

测试:

计算机生成了可选文字:
h AppDeIegate.h 
m AppDeIegate.m 
h V•ewControIIer.h 
m "ewControIIer.m 
Main.storyboard 
Assets. xcassets 
Launch Screen. storyboard 
Info.plist 
Supporting Files 
17 — 
20 
22 — 
26 
8 
9 
10 
11 
12 
13 
14 
15 
16 
18 
19 
21 
23 
24 
25 
27 
-touchesBegan:with 
#import "ViewController. h" 
#import "ZJTool. h" 
@interface ViewController ( ) 
cend 
@implementation ViewController 
(void) viewDidLoad 
(super viewDidLoadJ ; 
// Do any additional setup after loading the view, 
typically from a nib. 
(void) touchesBegan: (NSSet«UITouch *)touches withEvent: 
(UIEvent *)event 
IZJT001 log); 
2ø15-11-1ø 
U Tool 
h ZJTool.h 
m ZJTooI. m 
Products 
. app 
libZJTool.a

现在就可以任意调试:

计算机生成了可选文字:
000 
iPhone 6s Plus Running on iPhone Es Plus 
(h ) CO ZJTool)ö ZJTool.m ) O *log 
16 
rights 
rese rve 
2 
5 
6 
8 
9 
10 
12 
13 
14 
17 
18 
ZJT001.m 
ZJT001 
Created by base on 15/ø9/19. 
Copyright 0 2ø15# base. All 
#import "ZJTool. h" 
+ (void) log 
NSLog 
cend 
h AppDeIegate.h 
m AppDeIegate.m 
h V•ewControIIer.h 
m V•ewControIIer.m 
Main.storyboard 
Assets. xcassets 
Launch Screen. storyboard 
Info.plist 
Supporting Files 
h ZJTool.h 
m ZJTooI.m 
Products 
. app 
libZJTool.a 
El 
self (Class) 
U Tool 
LIÜ141( 
) Thread 1 ) n 0 41ZJTool 
(Udb)

(4)将模拟器和真机的静态库结合:

计算机生成了可选文字:
Products — bash — 80x24 
Last 10 in: Tue Nov le on tt seeø 
dDa ta/ tes t—ctce rugazcl Ivshezqjaqaznvjed/BuiId/P roducts/Debug—iphoneos/Iib test . a 
/ Use rs/ base/ Lib ra ry.' Deve lope r/Xcode/De rivedDa ta/test—ctce rugazcl Ivshezqj aqaznvj 
d/BuiId/Products/Debug—iphonesimuIator/Iibtest.a —output zonghe.a 
bases cd 'Users/ base/ LibrarWDeveIope rivedData/tes 
base eMacBoo —Pro: Pro uc s ase 
IPO —create 
ser s ase L r ary eve oper co 
e/ De rived Data/ test—ctce rug a z c I Ivshezqj aqaznvjed/BuiId/Products/Debug—iphoneos/Ii 
btest.a /Users/base/Library/DeveIoper/Xcode/DerivedData/test—ctcerugazcIIvshezqj 
aqaznvjed/BuiId/Products/Debug—iphonesimu Iato r/ Iibtest . 
basedeMacBook—Pro: Products bases 
Drive 
rDrop 
ktop 
Debug-iphoneos 
Debug-iphoneos 
Debug-iphonesimulator 
Release-iphoneos 
Release-iphonesimulator 
zonghe.a 
include 
libtest.a 
h ZJTools.h

但是,这个生成的综合文件的大小是模拟器和真机综合的2倍,所以一般不建议使用合并的。

mrc中生成的项目,打包成静态库,可以在arc环境下直接使用

1、先将环境改成mrc。

如果只有个别的mrc的文件,可以单独改成的mrc环境下的。

但是有很多mrc文件的话,需要打包成静态库

如果想生成真机和模拟器通过的文件,可以这样操作

但是整个包会变得比较大,很少用。

原文地址:https://www.cnblogs.com/base0225/p/5030792.html