导航:首页 > 程序命令 > xcode命令行工具

xcode命令行工具

发布时间:2022-08-18 17:58:30

‘壹’ xcode怎么打包ipa

如果你想自动打包 ipa 需要苹果开发者账号,XCode 为自动申请证书然后打包。

如果你没有苹果开发者账号,那就只能使用命令行打包了,而且打出来的包没有签名。

命令行工具是: xcodebuild

可以参见这个例子:网页链接

‘贰’ 如何安装命令行开发工具Xcode

‘叁’ xcode select怎么用

如果你的电脑中有几个xcode版本,比如一个xcode5.1.1,一个xcode6-beta, 当你打开工程的时候,通常会有一个默认配置,或者使用terminal命令行操作,需要选择使用xcode的不同版本,怎么更改这个配置呢? 请看下文:
It’s not uncommon developers to have multiple versions of Xcode installed. For example, I typically have the latest beta as well as the most current proction release installed.
However, there are times when you may want various tools, such as xcodebuild, to point to a specific Xcode folder. To faciliate this, you can use xcode-select. A common use case is if you use scripts and/or makefiles to build your projects.
Once you set the Xcode folder, xcodebuild will be invoked from the folder you specified.

The command line options are below:
xcode-select [-help]
xcode-select [-switch xcode_folder_path]
xcode-select [-print-path]
xcode-select [-version]

Here is how to print the current Xcode path:
1
2

~$ xcode-select --print-path
/Developer/Applications/Xcode.app

Line number 2 shows the current version of Xcode that is ‘active.’ If you are accessing xcodebuild or other related tools from a script, –print-path is the preferred means to determine the current Xcode location.
Use the -switch option to change to another version of Xcode on your system:
$ sudo xcode-select -switch /Users/JOHN/Downloads/Xcode45-DP3.app

This changes to the Xcode 4.5, Developer Preview 3 on my system. Note that root access is required to set the Xcode location, thus I have used sudo to execute the command as root.
Printing the path now looks as follows:
1
2

~$ xcode-select --print-path
/Users/JOHN/Downloads/Xcode45-DP3.app/Contents/Developer

To switch back to Xcode installed in the /Applications directory:
$ sudo xcode-select -switch /Applications/Xcode.app/

You can read more about xcode-select by view the man page from a terminal:
~$man xcode-select

‘肆’ mac系统的command_line_tools是做什么用的和Xcode什么关系

可以用它来建项目,可以写c语言程序,或者建立文件夹,都是可以的。

‘伍’ xcode使用方法

xcode使用方法:(以xcode5为例)


1,下载安装好xcode5后,就可以开始ios开发之旅了。首先打开xcode。选择新建一个xcode项目。

‘陆’ 使用mac进行ios几种命令行打包方式

自动打包的方式有如下几种:
一、使用xcodebuild进行打包
参考apple文档:https://developer.apple.com/library/prerelease/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
xcodebuild -project "${TARGET}.xcodeproj" -target ${TARGET} CODE_SIGN_IDENTITY="${IDENTITY}" clean //将project clean下

xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme archive //进行archive,生成xcarchive文件
xcodebuild -exportArchive -exportFormat IPA -archivePath MyMobileApp.xcarchive -exportPath MyMobileApp.ipa -exportProvisioningProfile 'MyMobileApp Distribution Profile'
确实是可以生成.ipa,但是可能会导致不能安装,https://developer.apple.com/library/prerelease/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html , 链接是apple的官方文档,文档大概的意思将 xcarchive文件作为.ipa方式进行导出, 为什么不能在ios设备上安装?
二、原生xcodebuild、xcrun进行打包,需要详细了解,可以看下这个链接 http://www.jianshu.com/p/1229476fbce4
具体打包指令和第一种方法区别不大,不同代码如下:
xcodebuild -scheme Zxh -configuration ${buildConfiguration} clean //对代码进行clean
xcodebuild -project Zxh.xcodeproj -scheme Zxh -configuration ${buildConfiguration} -destination generic/platform=ios archive -archivePath ${buildPath} //进行build,相当于在xcode里面进行command+b,生成.app文件
#xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/Zxh.app -o ${ipaName}.ipa --sign "iPhone Distribution:(打包证书)" //根据.app文件生成的ipa文件导出到指定目录
三、xctool进行自动打包

参考网页地址:http://www.tuicool.com/articles/uIZRZjy
1、确保安装了xctool

没有安装xctool,可以用brew安装,没有安装brew的,可以通过搜索安装brew,然后执行如下操作安装xctool

安装命令:sudo brew install xctool
介绍下xctool命令:
xctool 是FaceBook开源的一个命令行工具,用来替代苹果的xcodebuild工具。
先附上打包用的参考代码,如下:
#
cd AutoProject //进入项目目录

#
buildDay=$(date +%Y%m%d) //获取当前日期
buildTime=$(date +%Y%m%d%H%M) //获取当前时间
profile=”xxxx” //设置打包配置文件
#
buildConfiguration=”QA” //build时用的证书
buildPath=”../ArchiveProction/QA/${buildDay}/Auto_QA_${buildTime}.xcarchive” //build后归档的文件目录
ipaName=”../ipa/QA/${buildDay}/Auto_QA_${buildTime}.ipa” //打好包放置位置
#
xctool -scheme AutoProject -configuration ${buildConfiguration} clean //clean下工程
xctool -scheme AutoProject -configuration ${buildConfiguration} archive -archivePath ${buildPath} //对项目进行Archive, 将xcarchive文件导出到指定目录
xcodebuild -exportArchive -exportFormat IPA -archivePath ${buildPath} -exportPath ${ipaName} - exportProvisioningProfile “$profile” //生成的ipa文件导出到指定目录, 此处依然使用的是xcodebuild进行打包, 待优化

阅读全文

与xcode命令行工具相关的资料

热点内容
甘肃酒泉发票服务器地址 浏览:356
程序员专用诗集 浏览:208
微信租车系统源码 浏览:983
中国抗日狙击手电影 浏览:419
千王之王2000百度网盘资源 浏览:514
phpsocketepoll 浏览:726
小孩和熊的电影 浏览:241
python写网页界面的框架 浏览:6
当通过ssh远程连接弹性云服务器时 浏览:655
12306哪个app 浏览:680
免费网站电视剧电影全免费在线观看 浏览:737
如何快速清除app广告 浏览:716
单片机按键外部中断 浏览:560
单片机的usb供电 浏览:256
更改android分辨率 浏览:186
phpstaticfinal 浏览:695
成人伦理风月片电影 浏览:294
禁播爱情片 浏览:21
动漫电影免费版大全 浏览:14
java什么是this 浏览:811