目前工作中遇到的问题,是讲项目三大模块拆分,
将Discover、Shop和Events的源代码拆分到独立的项目中
拆分是个麻烦事,里面相互依赖很多 ,打包编译也异常复杂,各种报错
编译Event 遇到的问题
Showing All Errors Only
Undefined symbol: _G711_alaw2linear
Undefined symbols for architecture arm64:
"_G711_alaw2linear", referenced from:
-[HLStreamMediaPlayer fillingAudioData:] in HLStreamMediaPlayer.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决方案
#!/bin/bash cd /Users/zhangyuanhai/Desktop/wzshop #脚本路径 sh_Path=$1 target_name="WZShop" target_root_name="Plugin" target_name_spec="${target_name}.podspec" #读取package之后的目录 funPackagePath() { current_version=$(cat $target_name_spec | awk 'NR==3') substr=${current_version#*=} length=${#substr} substr_1=${substr: 2: (length-3)} path="${target_name}-"${substr_1} echo "${path}" return ${path} } ##1.清除缓存 echo "**************************1.清除缓存*********************************" pod cache clean --all #2.执行自动化打包framework echo "**************************2.执行自动化打包framework*********************************" echo "正在打包全部framework" pod package WZShop.podspec --force --embedded --no-mangle --exclude-deps --spec-sources=https://gitlab.wyzelabs.com.cn/wyze-app/wyzespec.git,https://github.com/CocoaPods/Specs.git --force echo "正在执行framework" framework_Path=$(pwd) echo "funPackagePath1" resultPath=$(funPackagePath) echo "funPackagePath2" datastatics_Path="${framework_Path}/WZShop/Products/" echo "framework_Path" if [ -d "$framework_Path"/"$resultPath" ]; then #3. 修改podspec文件 srcfile="config.rb" desfile="${framework_Path}/${resultPath}/${target_name_spec}" sed -i '' "s/${target_name}.framework/*.framework/g" $desfile sed -i '' "/^end$/d" $desfile echo "sed执行完成" cat $srcfile >> $desfile echo "cat执行完成" #5 上传 echo "**************************上传到远程服务器 ******************************" ##1)##删除build rm -rf "${framework_Path}/${resultPath}/build" ##2)强制远程拉取仓库 tagert_Path="/Users/zhangyuanhai/Desktop/wzshop" cd $tagert_Path git pull origin master ##3)移动文件 rm -rf "${tagert_Path}/${target_root_name}/ios/${target_name}" mv "${framework_Path}/${resultPath}" "${tagert_Path}/${target_root_name}/ios/${target_name}" ##4)提交文件 git add "./${target_root_name}/ios/${target_name}" git commit -m "${resultPath}" git push echo "sucess" else echo "make framework error" exit 1 fi
资源打包SDK
最好解决,各种模块的依赖关系,后续已解决 此处不再粘贴
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'YES', } s.public_header_files = 'WZShop/Classes/WZShopPrefixHeader.pch' s.resource_bundles = { 'WZShop' => ['WZShop/Assets/**/*'], } temp_path = 'WZShop' s.source_files = "#{temp_path}/**/*.{h,m}" #dependency s.dependency 'Braintree' s.dependency 'BraintreeDropIn' s.dependency 'Braintree/DataCollector' # s.dependency 'Braintree/Venmo' s.static_framework = true #Bug Fix The 'Pods-Template_app' target has transitive dependencies that include statically linked binaries: (FirebaseCore) s.dependency 'WZPlatformKit', '1.8.4' s.dependency 'IQKeyboardManager', '~> 6.3.0' s.dependency 'WZCommonModule', '0.0.12' end
关于xxxx.podspec
Pod::Spec.new do |s| s.name = "WZShop" s.version = "0.0.1.0" s.summary = "WZShop" s.description = <<-DESC TODO: WZShop DESC s.homepage = "git@xxx:xxx" s.license = { :type => "MIT"} s.author = { "xxxx" => "XXXXX.com.cn" } s.source = { :git => 'xxxxx.git', :tag => s.version.to_s } s.ios.deployment_target = '9.0' s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'YES', } temp_path = 'WZShop/Classes/Src' s.resource_bundle = { 'WZShop' => ['WZShop/Assets/**/*'] } s.prefix_header_file = 'WZShop/Classes/WZShopPrefixHeader.pch' s.prefix_header_contents = '#import "WZShopPrefixHeader.pch"' #s.vendored_libraries = "#{temp_path}/Lib/*.a" s.public_header_files = 'WZShop/Classes/WZShop.h' s.source_files = 'WZShop/Classes/WZShop.h' root_spec_path = 'WZShop/Classes' current_dir = File.realpath(File.dirname(__FILE__)) if File.file?(File.join(current_dir, "_DEV_ENV")) s.source_files = 'WZShop/Classes/**/*' else make_spec_path = File.join(current_dir, "_make_spec.rb") File.open(make_spec_path) do |fp| eval(fp.read) end root_path = File.join(current_dir, root_spec_path) traverse(s, root_path, root_spec_path) end # s.source_files = "'WZShop/Classes/*.{h,m}', 'WZShop/Classes/Lib/*.{h}'" #dependency s.dependency 'Braintree','4.30.0' s.dependency 'BraintreeDropIn', '7.4.0' s.dependency 'Braintree/DataCollector', '4.30.0' # s.dependency 'Braintree/Venmo' s.static_framework = true #Bug Fix The 'Pods-Template_app' target has transitive dependencies that include statically linked binaries: (FirebaseCore) s.dependency 'WZPlatformKit' s.dependency 'IQKeyboardManager', '6.3.0' s.dependency 'WZCommonModule' end