关于iOS终端命令快捷打包
(2023-01-06 10:28:27)分类: 關於iOS哪些事 |
终端打包:
1、cd到代码目录
cd 到带代码所在文件夹
2、清理
xcodebuild -target targetname clean
如果执行报错xcodebuild: error: The project 'targetname.xcodeproj' does not contain a target named 'targetname clean' 并且build文件夹存在,也可以手动删除build文件夹
3、编辑生成.app文件
xcodebuild -target targetname build
如果执行报错xcodebuild: error: The project 'targetname.xcodeproj' does not contain a target named 'targetname build'.可执行命令xcodebuild -target targetname
4、打包生成.ipa包
xcrun -sdk iphoneos PackageApplication -v targetname.app所在目录路径/targetname.app -o 生成.ipa文件所在目录路径/targetname.ipa
备注:如果第4步执行报xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH这个错误,
解决方案:
需要安装PackageApplication,下载地址:https://github.com/dqy168888/PackageApplication
1、cd到代码目录
cd 到带代码所在文件夹
2、清理
xcodebuild -target targetname clean
如果执行报错xcodebuild: error: The project 'targetname.xcodeproj' does not contain a target named 'targetname clean' 并且build文件夹存在,也可以手动删除build文件夹
3、编辑生成.app文件
xcodebuild -target targetname build
如果执行报错xcodebuild: error: The project 'targetname.xcodeproj' does not contain a target named 'targetname build'.可执行命令xcodebuild -target targetname
4、打包生成.ipa包
xcrun -sdk iphoneos PackageApplication -v targetname.app所在目录路径/targetname.app -o 生成.ipa文件所在目录路径/targetname.ipa
备注:如果第4步执行报xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH这个错误,
解决方案:
需要安装PackageApplication,下载地址:https://github.com/dqy168888/PackageApplication
,下载完成后解压,找到PackageApplication拷贝,打开finder,前往文件夹,输入路径/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin,把PackageApplication粘贴到这个文件夹里面,终端cd到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin目录下,执行命令:chmod
777 PackageApplication,然后再cd到代码所在文件夹,继续执行第4步操作。
备注:上面的targetname要修改为自己项目的targetname
前一篇:iPhone设备型号