IOS命令行编译

This document will note about the ios command build steps.

Step1: Sync code

You can use git svn or other vc tools sync you code to local disk. Then change the current dir to project dir that exist example.xcodeproj file.

Step2: Update project version

first you can use command:

$ agvtool what-version

if the output have a number this step can be skiped.

if the output have no number user follow commamd update project version

$ agvtool new-marketing-version 1.2
$ agvtool new-version -all 1.2

Step3: Unlock keychian

You can use follow command do this step

security list-keychains -s ~/Library/Keychains/login.keychain
security default-keychain -d user -s ~/Library/Keychains/login.keychain
security unlock-keychain -p password ~/Library/Keychains/login.keychain

If you undo this step, you next step maybe failed.

Step4: Build IOS Project

We will use commad xcodebuild build the ios project.

You can use follow command get help for this command

$ xcodebuild -h

Usage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild [-project <projectname>] -scheme <schemeName> [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -workspace <workspacename> -scheme <schemeName> [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]]
xcodebuild -showsdks

Options:
-usage                  print brief usage
-help                   print complete usage
-verbose                provide additional status output
-license                Show License agreement!
-project NAME           build the project NAME
-target NAME            build the target NAME
-alltargets             build all targets
-workspace NAME         build the workspace NAME
-scheme NAME            build the scheme NAME
-configuration NAME     use the build configuration NAME for building each target
-xcconfig PATH          apply the build settings defined in the file at PATH as overrides
-arch ARCH              build each target for the architecture ARCH; this will override architectures defined in the project
-sdk SDK                use SDK as the name or path of the base SDK when building the project
-toolchain NAME         use the toolchain with identifier or name NAME
-parallelizeTargets     build independent targets in parallel
-jobs NUMBER            specify the maximum number of concurrent build operations
-dry-run                do everything except actually running the commands
-showsdks               display a compact list of the installed SDKs
-showBuildSettings      display a list of build settings and values
-list                   lists the targets and configurations in a project, or the schemes in a workspace
-find-executable NAME   display the full path to executable NAME in the provided SDK and toolchain
-find-library NAME      display the full path to library NAME in the provided SDK and toolchain
-version                display the version of Xcode; with -sdk will display info about one or all installed SDKs

Show current xcodebuild version

$ xcodebuild -version
Xcode 4.5.2
Build version 4G2008a

Show current SDK

$ xcodebuild -showsdks
OS X SDKs:
    Mac OS X 10.7                   -sdk macosx10.7
    OS X 10.8                       -sdk macosx10.8
iOS SDKs:
    iOS 6.0                         -sdk iphoneos6.0
iOS Simulator SDKs:
    Simulator - iOS 6.0             -sdk iphonesimulator6.0

Show project information in project folder

$ xcodebuild -list

Build project via iOS 6.0 sdks

$ xcodebuild -sdk iphoneos6.0

or command

$ xcodebuild clean -sdk iphoneos6.0 -configuration Release

Step5: Generate ipa file

This step will generate the ipa file.

Will use follow command to finish this step:

$ xcrun -sdk iphoneos6.0 PackageApplication -v your/target/app/path.app -o your/output/path.ipa --embed your/mobileprovision/file/path
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值