iOS 8: "Go" ios dev-dev + Enterprise Edition wireless release One build package

Source: Internet
Author: User

Source Address: http://www.cnblogs.com/boch2436/p/4187326.html

Background: The project enters a fast iteration, requiring fast delivery of the Adhoc version and the Enterprise wireless release version. The bundle identifier and code signing are switched back and forth each time you pack, wasting a lot of time.

The sample project name name is Testonekeypublish.

    • Xcode settings:

1, assume that the default target (that is, testonekeypublish) as a personal developer certificate Adhoc release and normal connection debugging use, so that Testonekeypublish set as a personal development certificate bundle Identifier and code signing. Step slightly. Next, add a new target to use as a corporate wireless release.

2. In the project panel of Xcode, in targets, select Testonekeypublish,duplicate a new target, the default name is Testonekeypublish copy.

3. Change the name of the new target into testonekeypublishenterprise. Now there should be a new scheme for testonekeypublish copy in the toolbar scheme of Xcode. Yes, the name does not look very special. Next we have a unified name.

4. Select "Manage scheme ...", delete testonekeypublish copy inside, save, return to main screen select "New scheme ...", at "Target" column, select the newly renamed testonekeypublishenterprise, "Name" column to fill in "Testonekeypublishenterprise". Search for the product name in the new target, the "testonekeypublishenterprise" build settings, and modify the name to Testonekeypublishenterprise. This completes the unification of the naming.

5, since want to use as the Enterprise wireless release, of course need to modify testonekeypublishenterprise this target bundle identifier and code signing for enterprise certificate AppID and provisioning Profile Step slightly.

    • Automatic Package Script settings:

Go to GitHub to download Xcode_shell, get the "ipa-build" script, the contents are as follows:

  1 #!/bin/bash 2 3 #--------------------------------------------4 # function: Compile Xcode project and Play IPA package 5 # instruction: 6 # compiling Proj ECT 7 # Ipa-build <project directory> [-C <project Configuration>] [-O <ipa output directory&gt ;] [-T <target Name>] [-N] [-P <platform Identifier>] 8 # Compilation Workspace 9 # Ipa-build <workspace directory>-w-s <  schemename> [-C <project Configuration>] [-N] 10 # 11 # Parameter Description: The configuration of the-C NAME works, default to release.                 #-O path generates an IPA file for the output folder (must be an existing file path) by default to the "Build/ipa-build" folder under the project root path in the #-T NAME                The name of the target that needs to be compiled #-W compilation Workspace #-S name The scheme that needs to be compiled under workspace #-N is compiled before the Clean Engineering #-P platform Identifier # CCF # E-mail:[email protected] 20 # Date Created: 2012/09/24 #--------------------------------------------22 # Modified: 2013/02/18 23 # Modified by: CCF 24 # Modify content: Package to use the Xcrun command, and modify the second parameter #--------------------------------------------26 #  Date Modified: 2013/04/25 27 # Modified by: CCF 28 # Modify: Use getopts to process command parameters and increase the pre-compilation purge option #--------------------------------------------30 # Date Modified: 2013/04/26 31 # Modified by: CCF 32 # Modified: Added function of compiling workspace #-------------------------------------------- f [$#-lt 1];then echo "error! Should enter the root directory of the Xcode project after the Ipa-build command. " 2 to + FI (!-D $];then echo "error! The first param must be a directory. " 2-Fi #工程绝对路径 CD project_path=$ (PWD) #编译的configuration, default to release Build_config=rel Ease param_pattern= ":p: Nc:o:t:ws:" optind=2 and getopts $param _pattern optname "$optnam E "in" n ") should_clean=y 61;      "P") tmp_optind= $OPTIND tmp_optname= $optname 65   tmp_optarg= $OPTARG optind= $OPTIND-1 if getopts $param _pattern optname; then EC Ho "Error argument value for option $tmp _optname" optind= exit 2-Fi $tmp _optind 73 7 4 platform_id= $tmp _optarg 75 76;         "C") tmp_optind= $OPTIND tmp_optname= $optname tmp_optarg= $OPTARG 81 optind= $OPTIND-1 if getopts $param _pattern optname, then echo "Error argument value for Opti  On $tmp _optname "2 optind= _optind build_config= $tmp _optarg 89 90;; "O") tmp_optind= $OPTIND tmp_optname= $optname 94 tmp_optarg= $OPTARG ptind= $OPTIND-1 if getopts $param _pattern optname 98 echo "Error argument value for option $        Tmp_optname "Exit 2100 fi101 optind= $tmp _optind102 103 104 CD $tmp _optarg105 output_path=$ (PWD) 106 CD ${project_path}107 108 if [!-D $output _path];then109 echo "error! The value of option o must is an exist directory. " fi112 exit 2111 113;;          "W") workspace_name= ' *.xcworkspace ' $project _path/$workspace _name &>/dev/null117 rtnvalue=$?118 if [$rtnValue = 0];then119 build_workspace=$ (echo $ (basename $project _path/$ workspace_name)) else121 echo "error! Current path was not a Xcode workspace. Please check, or does not use-w option. " 122 Exit 2123 fi124 125;         126 "s") 127 tmp_optind= $OPTIND tmp_optname= $optname 129 tmp_optarg= $OPTARG 130 131 optind= $OPTIND -1132 if getopts $param _pattern optname; then133 echo "Error argument value for option      $tmp _optname "134       Exit 2135 fi136 optind= $tmp _optind137 138 build_scheme= $tmp _optarg139 140;         ; 141 "T") 142 tmp_optind= $OPTIND 143 tmp_optname= $optname 144 tmp_optarg= $OPTARG 145 146  optind= $OPTIND -1147 if getopts $param _pattern optname; then148 echo "Error argument value for option $tmp _optname "149 exit 2150 fi151 optind= $tmp _optind152 153 build_target= $tmp _OPTARG15 4 155;; 156 157 158 "?") 159 echo "error! Unknown option $OPTARG "Exit 2161;; 162 ":") 163 echo "error! No argument value for option $OPTARG "164 exit 2165;; 166 *) 167 # should not occur168 echo "error! Unknown Error while processing options "169 exit 2170;; 171 esac172 done173 174 175 #build文件夹路径176 build_path=${project_path}/build177 #生成的app文件目录178 appdirname=release-iph oneos179 if [$build_config = Debug];then180 appdirname=debug-iphoneos181 fi182 if [$build _config = Distribute];then183 appdirname= distribute-iphoneos184 fi185 #编译后文件路径 (only used when compiling workspace) 186 compiled_path=${build_path}/${appdirname}187 188 # Whether clean189 if ["$should _clean" = "y"];then190 xcodebuild clean-configuration ${build_config}191 fi192 193 #组合编译命令19 4 build_cmd= ' Xcodebuild ' 195 196 if ["$build _workspace"! = ""];then197 #编译workspace198 If ["$build _scheme" = "" ];then199 echo "error! Must provide a scheme by-s option together when using-w option to compile a workspace. " $ exit 2201 fi202 203 Build_cmd=${build_cmd} '-workspace ' ${build_workspace} '-scheme ' ${build_schem e} '-configuration ' ${build_config} ' configuration_build_dir= ' ${compiled_path} ' only_active_arch=no ' 204 205 else206 #         Compile project207 build_cmd=${build_cmd} '-configuration ' ${build_config}208 209 If ["$build _target"! = ""];then210 Build_cmd=${build_cmd} '-target ' ${build_target}211 fi212 213 fi214 215 216 #编译工程217 cd $project _path218 $build _cmd | | exit219 #进入build路径221 CD $build _path222 223 #创建ipa-build folder 224 if [-D./ipa-build];then225 rm-rf ipa-build226 F i227 mkdir ipa-build228 229 231 #app文件名称232 appname=$ (basename./${appdirname}/*.app) 233 #通过app文件名获得工程target名字234 target_name=$ (echo $appname | awk-f. ' {print $} ') 235 #app文件中Info. plist file path 236 app_infoplist_path=${build_path}/${ appdirname}/${appname}/info.plist237 #取版本号238 bundleshortversion=$ (/usr/libexec/plistbuddy-c "Print Cfbundleshortversionstring "${app_infoplist_path}" 239 #取build值240 bundleversion=$ (/usr/libexec/plistbuddy-c "Print Cfbundleversion "${app_infoplist_path}" 241 #取displayName242 displayname=$ (/usr/libexec/plistbuddy-c "Print Cfbundledisplayname "${app_infoplist_path}) 243 #IPA名称244 ipa_name=" ${displayname}_${platform_id}_${ bundleshortversion}_${build_config}_${bundleversion}_$ (date + "%y%m%d") "245 echo $ipa _name246 247 #xcrun打包248 Xcrun- SDK IphonEos packageapplication-v./${appdirname}/*.app-o ${build_path}/ipa-build/${ipa_name}.ipa | | exit249 if ["$output _path"! = ""];then251 cp ${build_path}/ipa-build/${ipa_name}.ipa $output _path/${ipa_name}.ip a252 echo "Copy IPA file successfully to the path $output _path/${ipa_name}.ipa" 253 fi

The author is very careful to explain the use of the entire script considerations, we can directly use.

1. Create a new directory:/users/username/documents/jenkins/xcode-shell, copy "Ipa-build" to the inside.

2, in the above directory, create a new dis-one-key-ipa-build.sh file, the content is:

1 #!/bin/bash2./ipa-build/users/username/documents/testonekeypublish/-n-t testonekeypublishenterprise-o/Users/ Username/documents/jenkins/xcode-shell

where/users/username/documents/company document/testonekeypublish/is the project path,-n indicates that the pre-package execution clean,-t indicates the target name and the location of the destination IPA file after-O.

3, give dis-one-key-ipa-build.sh execute permission. Then execute on the command line: ./dis-one-key-ipa-build.sh

This time will be automatically packaged, when finished, will be generated in the/users/username/documents/jenkins/xcode-shell directory an IPA file, the file name is very detailed.

4. Similarly, you can create a new dev-one-key-ipa-build.sh for ADHOC release, with the following content:

1 #!/bin/bash2./ipa-build/users/username/documents/testonekeypublish/-n-t testonekeypublish-o/Users/username/ Documents/jenkins/xcode-shell

You can now generate different packages at the command line by executing different script files.

    • Areas for improvement:

In the Xcode_shell project, there are some powerful scripts that can be configured with more automated feet, which are described on the GitHub home page and can be researched as needed.

iOS 8: "Go" ios dev-dev + Enterprise Edition wireless release One build package

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.