preface

The App often needs to be packaged for testing after testing. It is a waste of time to package the Archive every time. There are several buttons to select and click during the packaging process, which is very troublesome. Therefore, you can use the running script to package with one click, upload dandelion directly, notify the corresponding nail group, send the TWO-DIMENSIONAL code of ipA package download and @ the corresponding students.

For details, see the following configuration. Configure exportOptions.plist first and then the script

Configure exportOptions.plist

You can manually package once, see the file when you export the IPA package, and then add a dictionary provisioningProfiles to the file, where the key is the Bundle Identifier and value is the name describing the file. Place the modified file in the same directory as the XcodeProj file and add it to the project Supporting Files folder.

Configuration scripts

# 1. Place the script in the project directory (the parent directory of the.xcworkspace file or.xcodeProj file) # 2. Modify the corresponding parameter # 3 according to the project situation. First, in the terminal CD to the current project, Then drag the script directly into the termination point can enter \ # packaging time time * * * * = "` date + % Y - % m % d - m - H - % % % S `" echo ${time} \ * * * * # project name of the scheme Project_scheme ="SchemeDemo" # specify build_dir=".. Ipa_dir =${build_dir}/archive/temp.xcarchive # Specify ipA output directory ipa_dir=${build_dir}/ipa \ Pgyer_desc =" added XX feature, fixed XX bug" "cleaning project build directory **echo** "cleaning cleaning..." **if** [ -d ${build_dir} ] **then** rm -rf ${build_dir} **echo** -e "\n** CLEAN ARCHIVE FILE SUCCEED **\n" **fi** \ # Build # -usemodernBuildSystem =NO **echo** "archiving..." **echo** ${project_scheme} **echo** ${temp_archive_dir} xcodebuild archive -workspace ${project_scheme}.xcworkspace -scheme ${project_scheme} -archivePATH ${temp_ARCHIve_dir} -configuration Debug -UseModernBuildSystem=NO \ # Package IPA **echo** "exporting..." **echo** ${ipa_dir}/${time} xcodebuild -exportArchive -archivePath ${temp_archive_dir} -exportPath ${ipa_dir}/${time} -exportoptionsplist exportoptions. plist # uploading a dandelion **echo** "uploading..." ipa=${build_dir}/ipa/${time}/${project_scheme}.ipa curl -F 'file=@'${ipa} -F '_api_key='${api_key} -F 'buildUpdateDescription='${pgyer_desc} https://www.pgyer.com/apiv2/app/upload **echo** -e "\n** UPLOAD TO PGYER SUCCEED **\n" \ # notice nail @ corresponding students, Notification to the same enterprise may WeChat qrUrl = "URL" upload dandelion package \ # corresponding to certain links curl 'https://oapi.dingtalk.com/robot/send?access_token=' \ -h 'content-type: application/json' \ -d '{" msgType ":" markdown", "markdown": {"title":" new package ", "text": "#### new iOS package \n > \n >! [screenshot]('${qrUrl}')" } , "at": { "atMobiles": }}' **echo** -e "\n** UPLOAD TO PGYER SUCCEED **\n" \Copy the code

The exportOptions.plist is automatically generated based on the options. It is not written in the project. The same logic applies to package uploads to FIR notifications to nails. Other automatic packaging solutions will be provided later, please look forward to it!!