�����板��
��瑷�涓�����浠ュ�缂�绋�璇�瑷���涓轰袱绉�锛�缂�璇�璇�瑷����磋��寮�璇�瑷�����C++,Objective C�芥��缂�璇�璇�瑷���缂�璇�璇�瑷��ㄦ�ц����跺��锛�蹇�椤诲����杩�缂�璇��ㄧ�����哄�ㄧ��锛��哄�ㄧ����浠ョ�存�ュ��CPU涓��ц�锛���浠ユ�ц�����杈�楂�����JavaScript,Python�芥���磋��寮�璇�瑷����磋��寮�璇�瑷�涓���瑕�缁�杩�缂�璇���杩�绋�锛������ㄦ�ц����跺����杩�涓�涓�涓��寸��瑙i���ㄥ�浠g��瑙i��涓�CPU��浠ユ�ц���浠g������浠ワ�杈�缂�璇�璇�瑷��ヨ�达��磋��寮�璇�瑷�����浣�涓�浜�锛�浣���缂������寸�垫椿锛�涔�灏辨��涓哄��JS澶ф�濂姐��iOS寮���������甯哥�ㄨ��瑷���锛�Objective��Swift��浜����芥��缂�璇�璇�瑷�锛��㈠�ヨ��璇撮�芥����瑕�缂�璇����芥�ц�����浜�����缂�璇��芥��渚�璧�浜�Clang + LLVM. 绡�骞����讹��������虫敞Objective C锛���涓哄����涓�澶у��灏�寮������戒�����瀛��抽��锛���涓���缂�璇���杩�绋�锛���浠g��涔�娌¢��棰���锛�杩��规����涓���瀹�����浣���锛�������瑙d�缂�璇���杩�绋�锛�浼�瀵逛���寮���澶ф��甯��┿������������锛�浼�浠ヤ互涓���涓�渚�瀛�锛��ヨ�茶В濡�浣������╃��XCode��缂�璇�__attribute__Clang璀���澶���棰�澶������ョ�璇���������楂�椤圭��缂�璇���搴�瀵逛�涓��崇�����伴������璁蹭�澶у����������瀛�锛���浠ョ�存�ヨ烦�版����������涓�涓�绔�����iOS缂�璇�涓�绠℃��OC杩���Swift锛��芥������Clang浣�涓虹�璇��ㄥ��绔�锛�LLVM(Low level vritual machine)浣�涓虹�璇��ㄥ��绔�����浠ョ������缂�璇�杩�绋�濡��剧�璇��ㄥ��绔�缂�璇��ㄥ��绔���浠诲�℃��杩�琛�锛�璇�娉�����锛�璇�涔�����锛�����涓��翠唬��(intermediate representation )���ㄨ�涓�杩�绋�涓�锛�浼�杩�琛�绫诲��妫��ワ�濡������伴��璇�����璀���浼���娉ㄥ�烘�ュ�ㄥ��涓�琛���缂�璇��ㄥ��绔�缂�璇��ㄥ��绔�浼�杩�琛��哄�ㄦ���崇��浠g��浼���锛������哄�ㄨ��瑷�锛�骞朵�杩�琛��哄�ㄧ�稿�崇��浠g��浼�����iOS��缂�璇�杩�绋�锛���绔���澶���濡�涓�LVVM浼����ㄤ�杩�琛�BitCode������锛��炬�ユ��浼���绛�绛���LLVM�哄�ㄧ�������ㄤ���瀵逛������舵��锛�姣�濡�arm64绛�����涓������哄�ㄧ�����ц�涓�娆�XCode build��娴�绋�褰�浣���XCode涓�锛�����build���跺��锛�蹇��烽��command+B锛�锛�浼��ц�濡�涓�杩�绋�缂�璇�淇℃�����ヨ��╂��浠讹���寤虹�璇�������浠舵�舵��(name.app)澶�����浠舵����淇℃��锛�渚�濡���debug��澧�涓�Entitlements:{� � "application-identifier" = "app��bundleid";� � "aps-environment" = development;}1234512345�ц�CocoaPod缂�璇������� 渚�濡�瀵逛�浣跨��CocoaPod��宸ョ�浼��ц�CheckPods Manifest.lock缂�璇���涓�.m��浠讹�浣跨��CompileC��clang�戒护��CompileC ClassName.o ClassName.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compilerexport LANG=en_US.US-ASCIIexport PATH="..."clang -x objective-c -arch x86_64 -fmessage-length=0 -fobjc-arc... -Wno-missing-field-initializers ... -DDEBUG=1 ... -isysroot iPhoneSimulator10.1.sdk -fasm-blocks ... -I 涓������扮����浠� -F ����瑕���Framework� -iquote ����瑕���Framework� ... -c ClassName.c -o ClassName.o12341234��杩�杩�涓�缂�璇����戒护锛���浠���浠ョ����clang��瀹�����缂�璇��戒护-x� � � objective-c ��瀹�浜�缂�璇���璇�瑷�-arch� x86_64�跺��浜�缂�璇����舵��锛�绫讳技杩���arm7绛�-fobjc-arc 涓�浜���-f寮�澶寸��锛���瀹�浜�����arc绛�淇℃����杩�涓�涔�灏辨��涓轰�涔�浣���浠ュ�瑰������涓�涓�.m��浠堕���ㄩ��ARC缂�绋���-Wno-missing-field-initializers 涓�绯诲��浠�-W寮�澶寸��锛�������缂�璇���璀�����椤癸���杩�杩�浜�浣���浠ュ���跺��缂�璇���椤�-DDEBUG=1 涓�浜���-D寮�澶寸��锛�������棰�缂�璇�瀹�锛���杩�杩�浜�瀹���浠ュ���版�′欢缂�璇�-iPhoneSimulator10.1.sdk �跺��浜�缂�璇����ㄧ��iOS SDK����-I ��缂�璇�淇℃�����ユ��瀹���杈��╂��浠�-F �炬�ユ����瑕���Framework-c ClassName.c 缂�璇���浠�-o ClassName.o 缂�璇�浜х��12345678910111234567891011�炬�ラ��瑕���Framework锛�渚�濡�Foundation.framework,AFNetworking.framework,ALiPay.fframework缂�璇�xib��浠舵�疯�xib锛��剧��绛�璧�婧���浠跺�扮�����褰�缂�璇�ImageAssets澶���info.plist�ц�CocoaPod�����疯�Swift����搴���寤�.app��浠跺��瀵瑰�剁�惧��IPA������瀹逛�濡�锛���浠���杩�iTunes Store涓�杞藉井淇★��跺���峰�ipa瀹�瑁���锛��跺��瀹��������跺��瑁�������瀹广�� �抽��ipa锛����藉��涓�.zip����zip��浠讹�瑙e��缂╁��浼�寰��颁�涓���浠跺す����浠ワ�ipa��灏辨��涓�涓���������缂╁�����抽���句腑��WeChat锛����╂�剧ず����瀹癸��跺��灏辫�藉����板������ipa����瀹逛���浜�杩��舵��浠剁����瀹归��杩�XCode��Link Map File锛���浠���浠ョ�ユ��浜�杩��舵��浠朵腑甯�灞��� ��XCode -> Build Settings -> ��绱�map -> 寮���Write Link Map File寮�����锛��ㄧ�璇�锛���浠���浠ュ�ㄥ�瑰���Debug/Release��褰�涓����板�瑰���link map��text��浠躲�� 榛�璁ょ����褰���~/Library/Developer/Xcode/DerivedData/-瀵瑰�ID/Build/Intermediates/.build/Debug-iphoneos/.build/
1
1
渚�濡�锛�����TargetName��EPlusPan4Phone锛���褰�濡�涓�
/Users/huangwenchen/Library/Developer/Xcode/DerivedData/EPlusPan4Phone-eznmxzawtlhpmadnbyhafnpqpizo/Build/Intermediates/EPlusPan4Phone.build/Debug-iphonesimulator/EPlusPan4Phone.build
1
1
杩�涓���灏���浠剁��涓昏�����浠ヤ��ㄥ��锛�
Object files
杩�涓��ㄥ����������瀹�
- .o ����浠讹�涔�灏辨��涓������扮��.m��浠剁�璇�����缁�����
- .a��浠�
- ��瑕�link��framework
#锛� Arch: x86_64
#Object files:
[0] linker synthesized
[1] /EPlusPan4Phone.build/EPlusPan4Phone.app.xcent
[2]/EPlusPan4Phone.build/Objects-normal/x86_64/ULWBigResponseButton.o
��
[1175]/UMSocial_Sdk_4.4/libUMSocial_Sdk_4.4.a(UMSocialJob.o)
[1188]/iPhoneSimulator10.1.sdk/System/Library/Frameworks//Foundation.framework/Foundation
杩�涓��哄����瀛��ㄥ��瀹规��杈�绠���锛����㈡����浠剁��缂��凤����㈡����浠剁��璺�寰�����浠剁��缂��峰�ㄥ��缁�浼��ㄥ��
Sections
杩�涓��哄����渚�浜���涓�娈碉�Segment锛�����锛�Section锛��ㄥ���ц���浠朵腑��浣�缃���澶у���杩�涓��哄��瀹��寸����杩板�����ц���浠朵腑���ㄩ�ㄥ��瀹广��
�朵腑锛�娈靛��涓轰袱绉�
__TEXT 浠g��娈�
__DATA �版��娈�
渚�濡�锛�涔�������涓�涓�App锛�Sections�哄��濡�涓�锛���浠ョ���帮�浠g��娈电��
__text�����板����0x1000021B0锛�澶у���0x0077EBC3锛���浜����稿����涓�涓�涓�浣�缃�姝eソ��__stubs��浣�缃�0x100780D74��
# Sections:
# 浣�缃�� � � 澶у�� � � � 娈德� � � ��
# Address� Size� � � � Segment Section
0x1000021B0 0x0077EBC3� __TEXT� __text //浠g��
0x100780D74 0x00000FD8� __TEXT� __stubs
0x100781D4C 0x00001A50� __TEXT� __stub_helper
0x1007837A0 0x0001AD78� __TEXT� __const //甯搁��
0x10079E518 0x00041EF7� __TEXT� __objc_methname //OC �规���
0x1007E040F 0x00006E34� __TEXT� __objc_classname //OC 绫诲��
0x1007E7243 0x00010498� __TEXT� __objc_methtype� //OC �规�绫诲��
0x1007F76DC 0x0000E760� __TEXT� __gcc_except_tab
0x100805E40 0x00071693� __TEXT� __cstring� //瀛�绗�涓�
0x1008774D4 0x00004A9A� __TEXT� __ustring
0x10087BF6E 0x00000149� __TEXT� __entitlements
0x10087C0B8 0x0000D56C� __TEXT� __unwind_info
0x100889628 0x000129C0� __TEXT� __eh_frame
0x10089C000 0x00000010� __DATA� __nl_symbol_ptr
0x10089C010 0x000012C8� __DATA� __got
0x10089D2D8 0x00001520� __DATA� __la_symbol_ptr
0x10089E7F8 0x00000038� __DATA� __mod_init_func
0x10089E840 0x0003E140� __DATA� __const //甯搁��
0x1008DC980 0x0002D840� __DATA� __cfstring
0x10090A1C0 0x000022D8� __DATA� __objc_classlist // OC �规���琛�
0x10090C498 0x00000010� __DATA� __objc_nlclslist
0x10090C4A8 0x00000218� __DATA� __objc_catlist
0x10090C6C0 0x00000008� __DATA� __objc_nlcatlist
0x10090C6C8 0x00000510� __DATA� __objc_protolist // OC��璁���琛�
0x10090CBD8 0x00000008� __DATA� __objc_imageinfo
0x10090CBE0 0x00129280� __DATA� __objc_const // OC 甯搁��
0x100A35E60 0x00010908� __DATA� __objc_selrefs
0x100A46768 0x00000038� __DATA� __objc_protorefs
0x100A467A0 0x000020E8� __DATA� __objc_classrefs
0x100A48888 0x000019C0� __DATA� __objc_superrefs // OC �剁被寮���
0x100A4A248 0x0000A500� __DATA� __objc_ivar // OC iar
0x100A54748 0x00015CC0� __DATA� __objc_data
0x100A6A420 0x00007A30� __DATA� __data
0x100A71E60 0x0005AF70� __DATA� __bss
0x100ACCDE0 0x00053A4C� __DATA� __common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Symbols
Section�ㄥ��灏�浜�杩��舵��浠惰�琛�浜�涓�绾у��������锛�Symbols瀵�Section涓�����涓�娈佃�琛�浜�浜�绾у����锛�
渚�濡�锛�瀵逛�__TEXT __text,琛ㄧず浠g��娈典腑��浠g����瀹广��
0x1000021B0 0x0077EBC3� __TEXT� __text //浠g��
1
1
��瀵瑰���Symbols锛�璧峰��板��涔���0x1000021B0���朵腑锛���浠剁��峰��涓�����缂��峰�瑰�
[2]/EPlusPan4Phone.build/Objects-normal/x86_64/ULWBigResponseButton.o
1
1
�蜂���瀹瑰�涓�
# Symbols:
�板��� � 澶у�� � � � � ��浠剁��仿� � �规���
# Address� Size� � � � File� � � Name
0x1000021B0 0x00000109� [� 2]� � -[ULWBigResponseButton pointInside:withEvent:]
0x1000022C0 0x00000080� [� 3]� � -[ULWCategoryController liveAPI]
0x100002340 0x00000080� [� 3]� � -[ULWCategoryController categories]
....
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
�拌���锛���浠��ラ��OC���规���濡�浣�瀛��ㄧ��锛���浠����ョ����ivar��濡�浣�瀛��ㄧ����
棣����惧�版�版����涓�__DATA __objc_ivar
0x100A4A248 0x0000A500� __DATA� __objc_ivar
1
1
�跺��锛���绱㈣�涓��板��0x100A4A248锛�灏辫�芥�惧��ivar��瀛��ㄥ�哄����
0x100A4A248 0x00000008� [� 3] _OBJC_IVAR_$_ULWCategoryController._liveAPI
1
1
�煎�涓�������锛�瀵逛�String锛�浼��惧���瀛��ㄥ�版�版��娈典腑锛�渚�濡�,
0x1008065C2 0x00000029� [ 11] literal string: http://sns.whalecloud.com/sina2/callback
1
2
1
2
��浠ワ��ユ��浣�����瀵�Key浠ユ������褰㈠����ㄦ��浠堕��锛���涓�浠跺��遍�╃��浜�����
dSYM ��浠�
��浠��ㄦ��娆$�璇�杩���锛��戒�����涓�涓�dsym��浠躲��dsym��浠朵腑锛�瀛��ㄤ�16杩��剁���芥�板�板����灏���
��App瀹����ц���浜�杩��舵��浠朵腑锛�����杩��板���ヨ��ㄦ�规�������App crash���跺��锛�绗�涓��瑰伐�凤�Fabric,����绛�锛�浼�甯���浠����板穿婧���璋��ㄦ��锛�璋��ㄦ����浼�����crash�板����璋��ㄤ俊�����跺��锛���杩�dSYM��浠讹���浠�灏卞��浠ョ�卞�板����灏��板�蜂����芥�颁�缃���
XCode涓�锛�����Window -> Organizer��浠ョ���版��浠�������archier��浠�
�跺��锛�
�抽�� -> ��finder涓��剧ず��
�抽�� -> �ョ������瀹广��
�充�濡�浣���dsym��浠舵�ュ����宕╂�浣�缃�锛���浠ユ�ョ����涔�����涓�绡���瀹���
iOS 濡�浣�璋�璇�绗�涓��圭�璁″�扮��宕╂��ュ��
�d�浣��冲�板���充��扮��搴��ㄥ�烘��
__attribute__
��澶���灏�锛�浣��戒��ㄧ��涓��瑰�����iOS��澶存��浠朵腑锛�瑙��拌�attribute��
姣�濡�
__attribute__ ((warn_unused_result)) //濡���娌℃��浣跨�ㄨ����硷�缂�璇����跺��缁��鸿����
1
1
__attribtue__ ��涓�涓�楂�绾х����缂�璇��ㄦ��浠わ�瀹���璁稿�������瀹��存�村���缂�璇�妫��ュ��涓�浜�楂�绾х��缂�璇���浼�����
��涓轰�绉�锛�
�芥�板��� 锛�Function Attribute锛�
绫诲��灞��� (Variable Attribute )
����灞��� (Type Attribute )
璇�娉�缁���
__attribute__ 璇�娉��煎�涓猴�__attribute__ ((attribute-list))
�惧�ㄥ0�����封��;��������
姣�濡�锛��ㄤ��瑰�涓���甯歌���锛�澹版��涓�涓�灞��ф�����规��ㄥ�������寮��ㄤ�
@property (strong,nonatomic)CLASSNAME * property __deprecated;
1
1
杩��风��濂藉���锛�缁�寮�����涓�涓�杩�娓$������锛�璁╁������ラ��杩�涓�灞��ц�寮��ㄤ�锛�搴�褰�浣跨�ㄦ���扮��API锛�浣���琚�__deprecated��灞��т��跺��浠ユ�e父浣跨�ㄣ��濡����存�ュ���锛�浼�瀵艰�村������ㄦ�存��Pod���跺��锛�浠g����娉�杩�琛�浜���
__attribtue__��浣跨�ㄥ�烘��寰�澶�锛���������涓�iOS寮���涓�甯哥�ㄧ����涓�锛�
//寮���API锛��ㄤ�API�存��
#define __deprecated� � __attribute__((deprecated))
//甯���杩颁俊����寮���
#define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
//����__unavailable������/�规�锛�缂�璇��ㄧ�存�ユ����Error
#define __unavailable� __attribute__((unavailable))
//��璇�缂�璇���锛��充娇杩�涓�����/�规� 娌¤�浣跨��锛�涔�涓�瑕����鸿����
#define __unused� � __attribute__((unused))
//��__unused�稿��
#define __used� � � __attribute__((used))
//濡���涓�浣跨�ㄦ�规���杩����硷�杩�琛�璀���
#define __result_use_check __attribute__((__warn_unused_result__))
//OC�规���Swift涓�涓�����
#define __swift_unavailable(_msg)� __attribute__((__availability__(swift, unavailable, message=_msg)))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Clang璀���澶���
浣�涓�瀹�杩�瑙�杩�濡�涓�浠g��锛�
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
///浠g��
#pragma clang diagnostic pop
1
2
3
4
1
2
3
4
杩�娈典唬����浣��ㄦ��
瀵瑰���缂�璇���澧�杩�琛�����
蹇界��-Wundeclared-selector锛���澹版����锛�Selector璀���
缂�璇�浠g��
瀵圭�璇���澧�杩�琛��烘��
��杩�clang diagnostic push/pop,浣���浠ョ�垫椿���у�朵唬������缂�璇���椤广��
���ㄤ�����涓�绡���绔���锛�璇�缁���浠�缁�浜�XCode��璀����稿�冲��瀹广������绡�骞����讹�灏变�璇�缁�璁茶В浜���
iOS �����╃��Clang璀����ユ��楂�浠g��璐ㄩ��
棰�澶���
��璋�棰�澶���锛�灏辨���ㄧ�璇�涔�����澶�����棰�澶����藉�璁╀�瀹�涔�缂�璇��ㄥ����锛�瀹��版�′欢缂�璇���
姣�濡�锛�杩��风��浠g��寰�甯歌�
#ifdef DEBUG
//...
#else
//...
#endif
1
2
3
4
5
1
2
3
4
5
���凤���浠����蜂���浠ュ��涔��朵�棰�澶�������,��XCode-��涓�Target-build settings涓�锛���绱�proprecess���跺���瑰�诲�句腑���茬�����凤���浠ュ����涓�debug��release涓ょ�妯″�璁剧疆棰�澶���瀹���
姣�濡���浠���涓�锛�TestServer锛�琛ㄧず�ㄨ�涓�瀹�涓���浠g��杩�琛��ㄦ�璇����″��
�跺��锛�����澶�涓�Target锛��抽��Target锛�����Duplicate锛�锛�����涓�涓�Target璐�璐f�璇����″�ㄣ��杩��锋��浠�灏变��ㄦ��娆″���㈡�璇����″�ㄩ�借�淇��逛唬��浜���
#ifdef TESTMODE
//娴�璇����″�ㄧ�稿�崇��浠g��
#else
//��浜ф���″�ㄧ�稿�充唬��
#endif
1
2
3
4
5
1
2
3
4
5
���ヨ����
��甯革�濡���浣�浣跨��CocoaPod�ョ�$��涓��瑰�锛��d�浣���Build Phase��杩��峰����锛�
�朵腑锛�[CP]寮�澶寸��锛�灏辨��CocoaPod���ョ��������
Check Pods Manifest.lock锛��ㄦ�ユ���cocoapod绠$����涓��瑰�������瑕��存��
Embed Pods Framework锛�杩�琛������ラ�炬�ヤ��瑰�������/�ㄦ��搴�
Copy Pods Resources锛�杩�琛������ユ�疯�涓��瑰���璧�婧���浠�
��杩�浜���缃�淇℃���藉���ㄥ�ㄨ�涓���浠�(.xcodeprog)��
�拌���锛�CocoaPod������涔�灏卞ぇ�存��娓�妤�浜�锛���杩�淇���xcodeproject锛��跺����缃�缂�璇�������锛��ヤ�璇�涓��瑰��藉�姝g‘��缂�璇�杩��ャ��
���凤���浠�涔���浠ユ���ヨ��宸辩������锛��ュ��涓�浜�棰�澶���浜�����姣�濡�锛�姣�娆¤�琛�archive���跺��锛���浠��藉�椤绘���ㄨ���target��build����锛�濡���涓�涓�灏�蹇�锛�灏变�蹇�璁般��杩�涓�杩�绋�锛���浠���浠ラ��杩����ヨ�������ㄥ����
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
1
2
3
1
2
3
杩�娈佃�����跺��寰�绠���锛�璇诲��褰���pist��build������,�跺��瀵瑰�跺��涓�锛����板���ャ��
浣跨�ㄨ捣�ヤ�寰�绠���锛�
Xcode - ��涓�Target - ��涓�build phase
���╂坊��Run Script Phase
�跺����杩�娈佃�����疯�杩��伙�骞朵��鹃��Run Script Only When installing锛�淇�璇�������浠��ㄥ��瑁��拌�惧�涓����跺��锛���浼��ц�杩�娈佃���������藉����������瀛�涓�Auto Increase build number
�跺��锛����ㄨ�涓���������Link Binary With Libraries涓���
����缂�璇�����
������缂�璇�����瀵逛�CI锛���缁�����锛��ヨ�达��������ㄣ��iOS寮���涓�锛�缂�璇�����蹇�澶���涓や釜�戒护��锛�
//缂�璇���.app
xcodebuild� -workspace $projectName.xcworkspace -scheme $projectName� -configuration $buildConfig clean build SYMROOT=$buildAppToDir
//����
xcrun -sdk iphoneos PackageApplication -v $appDir/$projectName.app -o $appDir/$ipaName.ipa
��杩�info�戒护锛���浠ユ�ョ���拌��缁�����妗�
info xcodebuild
1
2
3
4
5
6
7
1
2
3
4
5
6
7
�ㄦ������������褰�涓�锛���渚�浜���涔���浣跨�ㄧ��涓�涓����ㄦ������������
��楂�椤圭��缂�璇���搴�
��甯革�褰�椤圭��寰�澶э�婧�浠g����涓��瑰�寮��ュ�澶����跺��锛���浠�浼����扮�璇�����搴�寰������ㄤ�瑙d�XCode��缂�璇�杩�绋���锛���浠���浠ヤ�浠ヤ�瑙�搴��ヤ���缂�璇���搴�锛�
�ョ��缂�璇��堕��
��浠���瑕�涓�涓���寰�锛��藉����扮�璇����堕�达�杩��锋���芥��涓�瀵规��锛��ラ����浠���浼���绌剁����娌℃��������
瀵逛�XCode 8锛��抽��XCode锛�缁�绔�杈��ヤ互涓���浠�
$ defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
1
1
�跺��锛�����XCode锛��跺��缂�璇�锛�浣�浼��ㄨ������扮�璇��堕�淬��
浠g��灞��㈢��浼���
forward declaration
��璋�forward declaration锛�灏辨��@class CLASSNAME锛���涓���#import CLASSNAME.h��杩��凤�缂�璇��ㄨ�藉ぇ澶ф��楂�#import���挎�㈤��搴���
瀵瑰父�ㄧ��宸ュ�风被杩�琛�����锛�Framework/.a锛�
������Framework��������搴�锛�杩��风�璇����跺��杩��ㄥ��浠g��灏变���瑕����扮�璇�浜���
甯哥�ㄥご��浠舵�惧�伴�缂�璇���浠堕��
XCode��pch��浠舵��棰�缂�璇���浠讹�杩�������瀹瑰�ㄦ�ц�XCode build涔���灏卞凡缁�琚�棰�缂�璇�锛�骞朵�寮��ュ�版��涓�涓�.m��浠堕��浜���
缂�璇��ㄩ��椤逛���
Debug妯″�涓�锛�涓�����dsym��浠�
涓������颁�锛�dysm��浠堕��瀛��ㄤ�璋�璇�淇℃��锛���Debug妯″�涓�锛���浠���浠ュ����XCode��LLDB杩�琛�璋�璇�����浠ワ�涓���瑕�����棰�澶���dsym��浠舵�ラ��浣�缂�璇���搴���
Debug寮���Build Active Architecture Only
��XCode -> Build Settings -> Build Active Architecture Only �逛负YES��杩��峰��锛���浠ュ��缂�璇�褰���������锛�姣�濡�arm7/arm64绛�绛�锛�璁板���寮���Debug妯″���杩�涓���椤瑰�ㄩ��������XCode涓����ㄥ���浜���
Debug妯″�涓�锛��抽��缂�璇��ㄤ���
缂�璇��ㄤ���
��缁�
���ヨ�绡���绔�杩���寰�澶���瀹规�冲��锛�绡�骞����讹�灏卞��杩��峰�с����杩�����浜�寰�澶�涓�寮�蹇���浜�锛�杩���������宸变��ワ���涓���锛��夸��恒��
���㈡���堕�翠�锛�浼�浠�缁�涓�浜�缂�璇���榛�绉���锛�
���ラ�澶���缂�璇�淇℃��
�芥�扮��璋��ㄨ�绋���杩�琛��舵�惧�板�芥�板�ㄤ�杩��舵��浠朵腑�����板��
����
��褰�
���ㄧ�璇���������
export LC_ALL=zh_CN.GB2312;
export LANG=zh_CN.GB2312
buildConfig="Release" //杩�����build妯″�
projectName=`find . -name *.xcodeproj | awk -F "[/.]" '{print $(NF-1)}'`
projectDir=`pwd`
wwwIPADir=~/Desktop/$projectName-IPA
isWorkSpace=true
echo "~~~~~~~~~~~~~~~~~~~寮�濮�缂�璇�~~~~~~~~~~~~~~~~~~~"
if [ -d "$wwwIPADir" ]; then
echo $wwwIPADir
echo "��浠剁��褰�瀛���"
else
echo "��浠剁��褰�涓�瀛���"
mkdir -pv $wwwIPADir
echo "��寤�${wwwIPADir}��褰�����"
fi
cd $projectDir
rm -rf ./build
buildAppToDir=$projectDir/build
infoPlist="$projectName/Info.plist"
bundleVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $infoPlist`
bundleIdentifier=`/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" $infoPlist`
bundleBuildVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $infoPlist`
if $isWorkSpace ; then� #������CocoaPod
echo� "寮�濮�缂�璇�workspace...."
xcodebuild� -workspace $projectName.xcworkspace -scheme $projectName� -configuration $buildConfig clean build SYMROOT=$buildAppToDir
else
echo� "寮�濮�缂�璇�target...."
xcodebuild� -target� $projectName� -configuration $buildConfig clean build SYMROOT=$buildAppToDir
fi
if test $? -eq 0
then
echo "~~~~~~~~~~~~~~~~~~~缂�璇�����~~~~~~~~~~~~~~~~~~~"
else
echo "~~~~~~~~~~~~~~~~~~~缂�璇�澶辫触~~~~~~~~~~~~~~~~~~~"
exit 1
fi
ipaName=`echo $projectName | tr "[:upper:]" "[:lower:]"` #灏�椤圭����杞�灏���
findFolderName=`find . -name "$buildConfig-*" -type d |xargs basename` #�ユ�剧��褰�
appDir=$buildAppToDir/$findFolderName/� #app���ㄨ矾寰�
echo "寮�濮�����$projectName.app��$projectName.ipa....."
xcrun -sdk iphoneos PackageApplication -v $appDir/$projectName.app -o $appDir/$ipaName.ipa
if [ -f "$appDir/$ipaName.ipa" ]
then
echo "����$ipaName.ipa����."
else
echo "����$ipaName.ipa澶辫触."
exit 1
fi
path=$wwwIPADir/$projectName$(date +%Y%m%d%H%M%S).ipa
cp -f -p $appDir/$ipaName.ipa $path� #�疯�ipa��浠�
echo "澶���$ipaName.ipa��${wwwIPADir}����"
echo "~~~~~~~~~~~~~~~~~~~缁���缂�璇�锛�澶�������~~~~~~~~~~~~~~~~~~~"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59