使用M1电脑pod package打包framework会出现各种各样问题,将踩到的坑记录如下:

pod 打包framework
安装sudo gem install cocoapodspackager

报错

xcodeselect: error: toolxcodebuildrequires Xcode, but active
developer directory ‘/Library/Developer/CommandLineTools’ is a command
line tools instance

如果本次确实已安装LineTool需要关联路径
执行下面命令

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

打包framework命令:

pod package 你的项目.podspec --force —embedded --no-mangle --exclude-deps

再次打包有以下报错问题支持arm7架构打包

/var/folders/j5/wglq81t90xs_vcwywb93c7pr0000gn/T/cocoapods-7w8f4l0n/Pods/Pods.xcodeproj:
warning: The iOS deployment target ‘IPHONEOS_DEPLOYMENT_TARGET’ is set
to 9.0, but the range of supported deployment target versions is 11.0
to 16.2.99. (in target ‘Podspackager’ from project ‘Pods’)
error: The armv7 architecture is deprecated. You should update your ARCHS build setting to remove the armv7 architecture. (in target
‘Podspackager’ from project ‘Pods’)
error: The armv7s architecture is deprecated. You should update your ARCHS build setting to remove the armv7s architecture. (in target
‘Pods-packager’ from project ‘Pods’)
/var/folders/j5/wglq81t90xs_vcwywb93c7pr0000gn/T/cocoapods-7w8f4l0n/Pods/Pods.xcodeproj:
warning: The iOS deployment target ‘IPHONEOS_DEPLOYMENT_TARGET’ is set
to 9.0, but the range of supported deployment target versions is 11.0
to 16.2.99. (in target ‘JDTGateway’ from project ‘Pods’)
error: The armv7 architecture is deprecated. You should update your ARCHS build setting to remove the armv7 architecture. (in target
‘JDTGateway’ from project ‘Pods’)
error: The armv7s architecture is deprecated. You should update your ARCHS build setting to remove the armv7s architecture. (in target
‘JDTGateway’ from project ‘Pods’)

问题2模拟器cpu架构与真机架构相同:

fatal error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
Pods/build/package.a and Pods/buildsim/package.a have the same
architectures (arm64) and can’t be in the same fat output file

问题3没找到模拟器编译后的包:

Usage:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
static [-] file […] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols] Usage:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-dynamic [-] file […] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #]
[-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#]
[-segs_read_write_addr 0x#] [-seg_addr_table ]
[-seg_addr_table_filename <file_system_path>] [-all_load]
[-noall_load] fatal error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
can’t open input file: Pods/build-sim/package.a (No such file or
directory)

以上解决方案
修改podspec文件,添加以下配置,真机、模拟器编译时候排除arm7等架构

s.pod_target_xcconfig = {
    # 'VALID_ARCHS' => 'arm64',
    'EXCLUDED_ARCHS[sdk=iphoneos*]' => 'armv7 armv7s',
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'armv7 armv7s arm64'
  }
  s.user_target_xcconfig = {
    # 'VALID_ARCHS' => 'arm64',
    'EXCLUDED_ARCHS[sdk=iphoneos*]' => 'armv7 armv7s',
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => "armv7 armv7s arm64"
  }

原文地址:https://blog.csdn.net/ilinlinying/article/details/129384123

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_14273.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注