部分第三方SDK只支持在真機下運行調(diào)試,需要在運行模擬器時忽略只支持真機運行的SDK,當(dāng)然在模擬器環(huán)境下SDK相關(guān)功能不可用段磨。
一、SDK相關(guān)代碼 編譯判斷
#if !TARGET_OS_SIMULATOR
//示例 騰訊會議SDK
#import <WeMeetSDK/WeMeetSDKAPI.h>
endif
二耗绿、忽略SDK在link鏈接
方案1:
在xcode工程配置 BuildSettings 中 設(shè)置 Excluded Source File Names
指定在模擬器環(huán)境不參與編輯的文件苹支。
image.png
方案2:
本地pod + Configuration
1)將不支持模擬器架構(gòu)的SDK封裝為本地pod
2)新增Configuration 例如SimularDebug
pod 'KSWemeet', :path => "./KSWeMeet", :configurations => ['UAT','STG','Debug','Release']
指定SDK的本地pod只在非模擬器(SimularDebug的Configuration )環(huán)境下才pod
運行模擬器時需要修改Configuration
方案3:
新增模擬器運行的target
新增target 不勾選 模擬器不支持的架構(gòu)即可
其他相關(guān)
1.本地podspec事例
Pod::Spec.new do |s|
s.name = "KSWemeet"
s.version = "1.2.4"
s.summary = "跨聲騰訊會議"
s.description = <<-DESC
騰訊會議。
DESC
s.homepage = "http://gitlab.corp.com/com./KSWemeet"
s.license = 'MIT'
s.author = "DoZhui"
s.platform = :ios, "9.0"
s.source = { :git => "wemeet", :tag => s.version }
s.requires_arc = true
s.default_subspec = 'WeMeet'
s.subspec 'WeMeet' do | wmt |
wmt.vendored_frameworks = 'WeMeetSDK/**.framework'
wmt.resource = 'conf/1400321069.conf'
wmt.dependency 'KSWemeet/dependencySDK'
end
s.subspec 'dependencySDK' do |dSDK|
dSDK.vendored_frameworks = 'Dependences/*.framework'
end
s.subspec 'WeMeetExtension' do |extension|
extension.vendored_frameworks = 'WeMeetExtension/*.framework'
extension.dependency 'KSWemeet/dependencySDK'
extension.frameworks = 'ReplayKit'
end
end
2.可能遇到Build Phases 中包含run script 用于上線打包剔除i386架構(gòu)腳本误阻,可通過判斷Configuration
僅在生產(chǎn)環(huán)境才剔除债蜜。
if [ $CONFIGURATION == Release ]; then
...lipo 剔除架構(gòu)腳本代碼
fi