在创建framework给他人用时,必须保证我们的framework是没有问题的,这就需要对此framework进行多次调试,如果每次修改framework后,再将此framework导出并添加到测试工程的话,就太麻烦了。因此我们最好能将此测试工程和这个framework放在一起进行调试,这就不得不提到workspace了,他可以管理多个工程,也可以将工程和framework打包前的源码进行联编。
12.24
1、xcode多个子工程联合编联开发sdk
1》创建workspace MyFriWorkspace.xcworkspace
2》在此workspace下创建两个工程 MyMainProject及MySecMainProject中,两个工程的Add to:和Group:都选择MyFriWorkspace 这时已经可以在一个workspace中管理两个工程了
3》建自定义sdk工程添加到workspace进行联编(添加进去两个工程能进行互相联编,最常见的应用就是静态库的开发。)
3.1》File - New - Project - Cocoa Touch Static Library 创建静态库MyFriSDK(按上边创建Project的方式创建sdk)(这里主要是MyMainProject与MyFriSDK的联编)
3.2》在sdk中声明实现方法MyFirstSDKAction
3.3》实现MyMainProject与MyFriSDK的联编:选中MyMainProject -》General -》 点击Linked Frameworks and Libraries + -》选中Workspace/libMyFriSDK.a
3.4》在build Setting -》Libary Search Paths和User Header Search Paths 添加sdk路径/Users/yangyangzi/Desktop/Task/静态库组件化/MyFriWorkspace/MyFriSDK (按照相同方法制作framework时,只在User Header Search Paths 添加sdk路径)
3.5》在MyMainProject中调用sdk中方法,选择目标工程-》运行
模拟器运行成功:bjc[64342]: Class AXAccessQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities (0x1273fd780) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/Accessibility.framework/Frameworks/AXHearingSupport.framework/AXHearingSupport (0x128fb3888). One of the two will be used. Which one is undefined.
objc[64342]: Class AXAccessQueueTimer is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities (0x1273fad50) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/Accessibility.framework/Frameworks/AXHearingSupport.framework/AXHearingSupport (0x128fb38d8). One of the two will be used. Which one is undefined.
2018-12-24 16:45:30.326883+0800 MySecMainProject[64342:3888769] [AXMediaCommon] Unable to look up screen scale
2018-12-24 16:45:30.327050+0800 MySecMainProject[64342:3888769] [AXMediaCommon] Unexpected physical screen orientation
2018-12-24 16:45:30.393599+0800 MySecMainProject[64342:3888769] [AXMediaCommon] Unable to look up screen scale
2018-12-24 16:45:30.422389+0800 MySecMainProject[64342:3888769] [AXMediaCommon] Unable to look up screen scale
2018-12-24 16:45:30.422543+0800 MySecMainProject[64342:3888769] [AXMediaCommon] Unexpected physical screen orientation
(sdk的log)MyFirstSDKActionMyFirstSDKAction
真机没有上边一堆,直接打印:MyFirstSDKActionMyFirstSDKAction
注:framework静态库的制作也是这个流程
2、查看.a 支持的架构: lipo -info +.a路径
查看.framework支持的架构:lipo -info + xxx.framework/xxxxFramework 如下图: